Network & delivery

8 min readUpdated

The TCP/IP model: 4 layers, how it maps to OSI, and the attacks at each layer

Quick answer

The TCP/IP model describes the internet's protocol suite in four layers, defined in RFC 1122 (1989): Link, Internet, Transport and Application. As data travels down the stack, each layer adds its own header: Ethernet, then IP, then TCP or UDP, around the application's data. It is simpler than the seven-layer OSI model and describes the protocols the internet actually runs, which makes it the clearest map of where attacks and defences sit.

01What is the TCP/IP model?

The TCP/IP model, also called the internet protocol suite, is the layered description of how the internet's protocols work together. It is named after its two central protocols, the Transmission Control Protocol and the Internet Protocol. Its authoritative definition is RFC 1122, the host requirements standard of October 1989, which says a host "typically must implement at least one protocol from each layer" and names four: Application, Transport, Internet and Link.

Unlike the OSI model, which was designed as a reference framework, TCP/IP was written down around protocols that were already running. That history explains most of the differences between the two.

DateMilestoneSource
December 1974First TCP specification, by Cerf, Dalal and SunshineRFC 675
September 1981IP and TCP published as separate standardsRFC 791, RFC 793
1 January 1983Target date for the ARPANET's switch from NCP to TCP/IPRFC 801
1984OSI reference model published as ISO 7498ISO 7498; ITU-T X.200 is the 1994 edition
October 1989RFC 1122 defines the four layers for internet hostsRFC 1122
August 2022TCP consolidated into a single standardRFC 9293

02The four layers of the TCP/IP model

From the bottom, the layers are Link, Internet, Transport and Application, summarised in the table below. Numbering runs bottom-up, as in OSI, although RFC 1122 lists the layers top-down. Each layer talks only to the layers directly above and below it: TCP hands segments to IP and does not care whether IP sends them over Ethernet, Wi-Fi or a GRE tunnel.

ICMP is a special case. RFC 1122 calls it "an integral part of IP" although it is carried inside IP like a transport protocol, so it sits in the Internet layer. ARP, which maps IP addresses to MAC addresses on a local network, is covered in RFC 1122's link layer chapter.

LayerJobMain protocolsAddressesData unit
4. ApplicationThe service itself: web, mail, names, remote loginHTTP, TLS, DNS, SMTP, SSHNames and URLsMessage
3. TransportDelivery between programs, reliable (TCP) or not (UDP)TCP, UDP, and QUIC on top of UDPPortsSegment (TCP), datagram (UDP)
2. InternetMoving packets between networks, hop by hopIPv4, IPv6, ICMPIP addressesPacket
1. Link (also called network access)Delivery to the next device on the same networkEthernet, Wi-Fi, ARPMAC addressesFrame

03OSI vs TCP/IP: how the layers map

The two models describe the same traffic at different resolutions. TCP/IP folds OSI's top three layers into one Application layer and its bottom two into one Link layer, while Transport and Network line up one to one; the full mapping is in the table below.

A detail many comparisons miss: RFC 1122 says the internet application layer "essentially combines the functions of the top two layers -- Presentation and Application -- of the OSI reference model", and does not mention Session at all. That is why TLS is placed inconsistently: it encrypts like a presentation layer, keeps session state like a session layer, and runs as part of the application on top of TCP. Beyond the mapping, four differences matter:

  • Origin: OSI was designed by committee as a reference first; TCP/IP describes protocols that were already deployed
  • Layer count: seven against four, and many textbooks teach a five-layer hybrid that splits Link into data link and physical
  • Strictness: OSI defines clean boundaries; TCP/IP is pragmatic, and RFC 3439 (2002) even has a section titled Layering Considered Harmful
  • Use today: networks run TCP/IP but engineers speak OSI numbers, so Layer 7 means the application and Layer 3/4 means IP and TCP or UDP
OSI layerTCP/IP layerExample
7 ApplicationApplicationAn HTTP request, a DNS query
6 PresentationApplicationTLS encryption, compression, character encoding
5 SessionApplicationTLS session resumption, RPC sessions
4 TransportTransportTCP, UDP
3 NetworkInternetIP, ICMP
2 Data linkLinkEthernet frames, ARP
1 PhysicalLink (left to the network technology)Copper, fibre, radio

04Encapsulation: what each layer adds, from a real capture

As data travels down the stack, each layer wraps it in its own header, and the receiving host unwraps them in reverse. The capture below shows a TCP handshake, a 37-byte HTTP request (GET / HTTP/1.1 plus a Host header) and a 3,000-byte reply on a link with a 1,500-byte MTU. The length printed after the EtherType is the whole frame as captured, headers included; the length at the end is the TCP payload alone.

tcpdump -e -nn on a 1,500-byte MTU link in an isolated namespace (timestamps and TCP option values trimmed)
ethertype IPv4 (0x0800), length 74: 127.0.0.1.54966 > 127.0.0.1.8080: Flags [S], win 64240, options [mss 1460,sackOK,TS,nop,wscale 7], length 0
ethertype IPv4 (0x0800), length 74: 127.0.0.1.8080 > 127.0.0.1.54966: Flags [S.], win 65160, options [mss 1460,sackOK,TS,nop,wscale 7], length 0
ethertype IPv4 (0x0800), length 66: 127.0.0.1.54966 > 127.0.0.1.8080: Flags [.], ack 1, win 502, options [nop,nop,TS], length 0
ethertype IPv4 (0x0800), length 103: 127.0.0.1.54966 > 127.0.0.1.8080: Flags [P.], seq 1:38, ack 1, options [nop,nop,TS], length 37: HTTP: GET / HTTP/1.1
ethertype IPv4 (0x0800), length 66: 127.0.0.1.8080 > 127.0.0.1.54966: Flags [.], ack 38, win 509, options [nop,nop,TS], length 0
ethertype IPv4 (0x0800), length 1514: 127.0.0.1.8080 > 127.0.0.1.54966: Flags [.], seq 1:1449, ack 38, options [nop,nop,TS], length 1448
ethertype IPv4 (0x0800), length 1514: 127.0.0.1.8080 > 127.0.0.1.54966: Flags [.], seq 1449:2897, ack 38, options [nop,nop,TS], length 1448
ethertype IPv4 (0x0800), length 170: 127.0.0.1.8080 > 127.0.0.1.54966: Flags [P.], seq 2897:3001, ack 38, options [nop,nop,TS], length 104

05How much of a packet is headers? A worked calculation

For small requests, most of each frame is headers; for bulk data, very little. In the 103-byte request frame above, the Link layer adds 14 bytes (two MAC addresses and the EtherType), the Internet layer 20 bytes of IPv4 header (an IPv6 header is a fixed 40), and the Transport layer 32 bytes of TCP: a 20-byte header plus 12 bytes for the timestamps option. That is 66 bytes of headers around 37 bytes of HTTP, 64% of the frame. The SYN is 74 bytes because its options (MSS, SACK, timestamps and window scale) take 20 bytes.

For bulk data the ratio flips. A 1,500-byte IP packet carries 1,500 - 20 - 32 = 1,448 bytes of payload, which is exactly what the full segments show, in 1,514-byte frames. On the wire Ethernet also adds a 4-byte frame check sequence, an 8-byte preamble and a 12-byte gap, so each full segment occupies 1,538 byte times: 1,448 / 1,538 = 94.1% efficiency. TLS 1.3, when present, adds a 5-byte record header, a content-type byte and the cipher's tag, 16 bytes for AES-GCM, to every record.

The same arithmetic sets a link's packet-rate ceiling. The smallest Ethernet frame is 64 bytes, 84 byte times with preamble and gap, so 1 Gbit/s carries at most 10^9 / (84 x 8) = about 1.49 million packets per second; RFC 2544 lists the matching 14,880 frames per second for 10 Mbit/s Ethernet. The bandwidth and packet-rate calculator and the MTU and MSS calculator do these sums for other sizes, and bps vs pps vs rps explains why floods are measured all three ways.

LayerHeader in the request frameBytes
Link (Ethernet)Destination MAC, source MAC, EtherType14, plus a 4-byte FCS on the wire
Internet (IPv4)Version, length, TTL, protocol, addresses20 (IPv6: 40)
Transport (TCP)Ports, sequence and acknowledgement numbers, flags, window, timestamps option20 + 12 = 32
Application (HTTP)The request line and Host header37
Whole captured frameHeaders 66, payload 37103

06Which attacks target which TCP/IP layer?

Each layer has its own resource to exhaust or trust to abuse, and placing an attack on the model tells you which defence can even see it. Reflection attacks cross layers: DNS amplification abuses an application protocol, but the damage is Internet- and Transport-layer volume at the victim, so it is stopped by capacity rather than by inspecting requests. The types of DDoS attacks overview groups them the same way.

TCP/IP layerWhat gets attackedExamplesDefence that works there
LinkLocal trust in switches and ARP tablesARP spoofing, MAC flooding (local network only)Switch port security and ARP inspection; not reachable from the internet
InternetLink capacity and routingPing flood, smurf attack, ping of death, fragment floods, BGP hijackingUpstream capacity and filtering, anti-spoofing, RPKI
TransportConnection state and packet rateSYN flood, ACK flood, UDP floodSYN cookies, stateless filtering, a proxy that completes handshakes itself
ApplicationServer work per request, and protocol logicHTTP flood, Slowloris, SSL/TLS flood, HTTP/2 Rapid ResetWAF, per-client request limits, challenges, caching

07Where defences sit, and what a reverse proxy covers

A defence can only judge what its layer can see. A router filter sees addresses and protocol numbers, a stateful firewall sees ports and connection state, and only something that terminates TLS and parses HTTP can see a URL, a cookie or a header.

A reverse proxy works at the top two layers. It completes the TCP handshake itself, so half-open connections and spoofed packets never reach the origin, and it reads every HTTP request, so it can drop those that belong to a flood. What it cannot do is make a full link less full: if a volumetric flood saturates the capacity in front of it, what decides the outcome is the network's capacity and upstream filtering. It also covers only what it proxies, HTTP and HTTPS; other services on the same host need network-level protection. Layer 3/4 vs Layer 7 sets out the split.

08Capturing traffic layer by layer with tcpdump

A capture filter is a quick way to watch one layer at a time. All the filters below compile with tcpdump 4.99.3; -n skips name lookups, -i picks the interface and -e adds the link-layer header, as in the capture above. Note what the last one shows: with TLS, a capture reveals ports, sizes and timing but not the request, so application-layer inspection has to happen where TLS is terminated.

Capture filters by TCP/IP layer (filters compile with tcpdump -d)
# Link: ARP, which only exists on the local network
tcpdump -ni eth0 -e arp

# Internet: ICMP for IPv4 and IPv6, then IPv4 fragments
tcpdump -ni eth0 'icmp or icmp6'
tcpdump -ni eth0 'ip[6:2] & 0x3fff != 0'

# Transport: pure SYNs (new connection attempts; tcp[] offsets match IPv4 only), then UDP other than DNS
tcpdump -ni eth0 'tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-syn'
tcpdump -ni eth0 'udp and not port 53'

# Application: traffic to HTTPS, whose content stays encrypted
tcpdump -ni eth0 'tcp dst port 443'

Questions

Frequently asked questions

01What are the 4 layers of the TCP/IP model?
From top to bottom: Application (HTTP, DNS, SMTP, SSH), Transport (TCP and UDP), Internet (IP and ICMP) and Link, also called network access (Ethernet, Wi-Fi, ARP). RFC 1122 defines these four layers and says a host typically implements at least one protocol from each. Some textbooks split the Link layer into data link and physical and teach five layers, but the standard has four.
02Is TCP/IP 4 layers or 5 layers?
The standard, RFC 1122, has four layers. A five-layer version appears in many textbooks, which split the bottom Link layer into a data link layer and a physical layer to match the lower half of the OSI model. Both describe the same protocols; the five-layer version simply names the physical medium separately, which RFC 1122 leaves to the network technology.
03Which TCP/IP layer are HTTP and TLS in?
HTTP is in the Application layer, and so are DNS, SMTP and SSH. TLS is usually placed there too, because it runs on top of TCP and below HTTP inside the same program; in OSI terms it is variously called layer 5 or 6, since it keeps session state and encrypts. HTTP/3 runs over QUIC, which sits in the Transport layer on top of UDP.
04Why does the internet use TCP/IP instead of OSI?
Because TCP/IP was already running when the OSI protocols were being standardised. The ARPANET's switch to TCP/IP was planned for 1 January 1983, the OSI reference model was published in 1984, and by the time OSI protocol implementations matured the internet had grown around TCP/IP. OSI survives as a teaching model and as the source of layer numbers such as Layer 7.
05Where does ICMP fit in the TCP/IP model?
ICMP belongs to the Internet layer. It is carried inside IP packets like a transport protocol, but RFC 1122 describes it as an integral part of IP: it reports errors such as unreachable ports and expired hop limits, and it carries ping. That is why ICMP floods and the ping of death count as Internet-layer, or OSI layer 3, attacks.

Sources

Sources and verification

Checked on 13 November 2026 on Debian 12: the capture filters in “Capturing traffic layer by layer with tcpdump” compile with tcpdump -d (tcpdump 4.99.3). Other configuration, commands, log lines and output on this page are examples: adapt them to your system and check them before use.

  1. 01RFC 1122: Requirements for Internet Hosts, Communication Layers · IETF
  2. 02RFC 675: Specification of Internet Transmission Control Program · IETF
  3. 03RFC 801: NCP/TCP Transition Plan · IETF
  4. 04RFC 791: Internet Protocol · IETF
  5. 05RFC 9293: Transmission Control Protocol (TCP) · IETF
  6. 06RFC 7323: TCP Extensions for High Performance (timestamps option) · IETF
  7. 07RFC 894: A Standard for the Transmission of IP Datagrams over Ethernet Networks · IETF
  8. 08RFC 2544: Benchmarking Methodology for Network Interconnect Devices (Appendix B, frame rates) · IETF
  9. 09RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3 · IETF
  10. 10RFC 3439: Some Internet Architectural Guidelines and Philosophy · IETF
  11. 11ITU-T X.200: Open Systems Interconnection, Basic Reference Model · ITU-T
  12. 12OSI model (history: ISO 7498, 1984) · Wikipedia
  13. 13RFC 5116: An Interface and Algorithms for Authenticated Encryption (AES-GCM tag length) · IETF

Last updated