Layers, frames and packets
Every message you send is wrapped in headers, one per layer, and cut to fit the smallest pipe on the path. Learn what each layer adds and why 1,500 bytes rules everything.
Networking is built in layers. Each layer solves one problem and relies on the one below it. The application says what it wants to say. The transport layer, TCP or UDP, gets it to the right program on the right machine. The network layer, IP, gets it to the right machine across many networks. The link layer, usually Ethernet or Wi-Fi, gets it across one physical hop.
Wrapping each layer's data inside the next layer's header is called encapsulation. On the way out, every layer adds its header in front. On the way in, every layer strips its own header and hands the rest up.
Wrap a request in its headers
First packet on the wire · 1091 bytes of a 1,518-byte maximum Ethernet frame
- Packets
- 1
- Data per packet (max)
- 1,448 B
- Bytes on the wire
- 1.1 KB
- Overhead
- 8.3%
What each header carries
| Layer | Header | Main fields | Answers |
|---|---|---|---|
| Link (Ethernet) | 14 bytes, plus a 4-byte checksum trailer | Destination MAC, source MAC, EtherType | Which device on this local network? |
| Network (IPv4) | 20 bytes without options | Source and destination IP, TTL, protocol, total length | Which machine on the internet? |
| Network (IPv6) | 40 bytes, fixed | Source and destination IP, hop limit, next header | Same, with 128-bit addresses |
| Transport (TCP) | 20 bytes, often 32 with timestamps | Ports, sequence and ACK numbers, window, flags | Which program, and which bytes are these? |
| Transport (UDP) | 8 bytes | Ports, length, checksum | Which program? Nothing else. |
| TLS record | 5 bytes plus a 16-byte authentication tag | Content type, length | Is this encrypted data intact and authentic? |
MTU: the 1,500-byte ceiling
Every link has a maximum transmission unit, the largest packet it carries in one frame. Standard Ethernet's MTU is 1,500 bytes, and since most paths cross Ethernet somewhere, 1,500 is the de facto internet MTU. Subtract 20 bytes of IPv4 header and 20 of TCP, and each TCP segment carries at most 1,460 bytes of your data. That number is the maximum segment size, MSS.
- Payload
- 100,000 bytes
- MSS on a plain IPv4 path
- 1,500 − 20 (IP) − 20 (TCP) = 1,460 bytes
- With TCP timestamps (common)
- 1,460 − 12 = 1,448 bytes per segment
- Segments
- ⌈100,000 ÷ 1,448⌉ = 70 packets
- Header bytes on the wire
- 70 × (14 + 20 + 32) = 4,620 bytes, about 4.6%
Large transfers pay a few percent in headers. A 40-byte heartbeat pays more than 60%.
Go deeperPath MTU discovery and black holes
Some links have a smaller MTU than 1,500: VPN tunnels, PPPoE home connections at 1,492, or overlay networks in Kubernetes that add their own headers. A packet too big for a link must be fragmented or dropped.
Modern TCP sets the IP Don't Fragment bit and relies on path MTU discovery: a router that cannot forward a too-large packet drops it and sends back an ICMP “packet too big” message with the right size. The sender lowers its packet size and retries.
Firewalls that block all ICMP break this. Small packets, such as the TCP handshake and short requests, get through; the first full-size packet vanishes and the connection hangs. This is called a PMTU black hole. The tell-tale sign: curl connects, sends headers, then stalls when the response gets large. Fixes include clamping the MSS at the tunnel edge or enabling packetisation-layer discovery, which probes sizes without ICMP.
Where you will meet it
VXLAN-based pod networks add 50 bytes of headers, so pod MTUs are often set to 1,450. A mismatch causes exactly the large-response stalls described above.
“Works off VPN, hangs on VPN for big pages” is a classic PMTU problem. ping -M do -s 1472 host tests whether a full 1,500-byte packet gets through.
Data centres often run a 9,000-byte MTU inside the cluster, cutting per-packet overhead for storage and database traffic.
Words to know
- Encapsulation
- Wrapping one layer's data in the next layer's header.
- MTU
- Maximum transmission unit: the largest packet a link carries, usually 1,500 bytes.
- MSS
- Maximum segment size: the most application data one TCP segment can carry on a path.
- Frame
- A link-layer unit, such as one Ethernet frame. A packet is the IP-layer unit; a segment is TCP's.
Check yourself
Answer out loud before you open each one.
What is the MSS on a standard Ethernet path with IPv4 and no TCP options?
1,460 bytes: 1,500 MTU minus 20 bytes of IP header and 20 of TCP header.
What does encapsulation mean?
Each layer wraps the data from the layer above with its own header. Receivers strip one header per layer.
A connection handshakes fine but stalls on the first large response. What do you suspect?
A PMTU black hole: a smaller MTU somewhere on the path, and ICMP “packet too big” messages being blocked.
Try it
Run ping -c 3 -M do -s 1472 example.com on Linux (or ping -D -s 1472 on macOS). 1,472 + 8 (ICMP) + 20 (IP) = 1,500. Then try 1,473 and read the error.