Packet sizes, MTU and MSS explained
Every link has a largest packet it can carry, the MTU. Get it wrong somewhere along a path and you see one of the most confusing faults in networking: connections that open fine and then hang as soon as real data flows. A little arithmetic and one ping command usually find it.
MTU: the largest packet a link carries
The maximum transmission unit (MTU) is the largest IP packet, headers included, that a link can carry in one frame. Standard Ethernet carries IP packets of up to 1,500 bytes, a limit that dates back to RFC 894 in 1984. The Ethernet header and checksum come on top of that and are not counted in the MTU.
Other links differ:
- PPPoE, used by many DSL and fiber broadband services, puts a 6-byte PPPoE header and a 2-byte PPP field inside the 1,500-byte Ethernet payload, leaving 1,492 bytes unless both ends agree to use larger frames (RFC 4638).
- Tunnels and VPNs add their own headers, so the usable MTU inside them is smaller than the link underneath.
- Jumbo frames are larger Ethernet frames, usually configured as 9,000 bytes on data center and research networks. ESnet reports they can roughly double performance on 10G paths on older hardware, especially for UDP, and help TCP recover faster after loss. Every device on the segment must be set to the same size; Ethernet has no way to detect a mismatch.
- IPv6 requires every link to support at least 1,280 bytes.
Header sizes
| Header | Size | Notes |
|---|---|---|
| IPv4 | 20 bytes | Minimum; options can extend it to 60 bytes |
| IPv6 | 40 bytes | Fixed; extension headers add more |
| TCP | 20 bytes | Without options; options can add up to 40 more |
| UDP | 8 bytes | Fixed |
| ICMP echo (ping) | 8 bytes | Header before the ping data |
MSS: data per TCP segment
The maximum segment size (MSS) is the largest amount of TCP data, not counting headers, that a host wants to receive in one segment. Each side announces its MSS in the SYN when the connection opens. RFC 9293 defines it as the effective MTU minus the fixed IP and TCP headers:
- IPv4 on Ethernet: 1,500 − 20 − 20 = 1,460 bytes
- IPv6 on Ethernet: 1,500 − 40 − 20 = 1,440 bytes
- IPv4 over PPPoE: 1,492 − 20 − 20 = 1,452 bytes
- IPv4 with 9,000-byte jumbo frames: 9,000 − 40 = 8,960 bytes
TCP options such as timestamps take space from the segment, so the data actually carried per packet is often a little lower. If no MSS is announced, TCP must assume 536 bytes for IPv4 and 1,220 bytes for IPv6.
Fragmentation and path MTU discovery
When a packet is bigger than the next link's MTU, IPv4 can split it into fragments, unless the sender set the Don't Fragment (DF) flag, in which case the router drops it. IPv6 routers never fragment; only the sending host may. Fragmentation is costly and fragile: lose one fragment and the whole packet is lost.
So TCP normally uses path MTU discovery (PMTUD): it sends full-size packets with DF set, and a router that cannot forward one sends back an ICMP message ("Fragmentation Needed" in IPv4, "Packet Too Big" in IPv6) giving the smaller MTU. The sender then lowers its packet size for that destination.
MTU black holes
PMTUD fails when those ICMP messages are blocked, often by a firewall configured to drop all ICMP. The sender never learns that its packets are too big, and the router keeps silently dropping them. This is an MTU black hole. Typical symptoms, as listed in the Linux iptables documentation:
- Web pages start to load and then stall.
- Small emails send but large ones hang.
- ssh logs in fine, but scp hangs after the handshake.
The fixes, best first:
- Let the ICMP through. Allow ICMP "Fragmentation Needed" (type 3, code 4) and ICMPv6 "Packet Too Big" on firewalls.
- Packetization-layer PMTUD. RFC 4821 describes probing with increasing segment sizes instead of trusting ICMP. On Linux,
net.ipv4.tcp_mtu_probing = 1turns this on when a black hole is detected; ESnet recommends 1, especially with jumbo frames. - MSS clamping on the router or firewall where the MTU shrinks (see below).
MSS clamping
A router can rewrite the MSS value in TCP SYN packets passing through it, so both ends agree on segments small enough for the narrow link. On Linux with iptables:
iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
This sets the MSS to the path MTU minus 40 for IPv4 (minus 60 for IPv6). With nftables (Linux 4.14 or later):
nft add rule ip filter forward tcp flags syn tcp option maxseg size set rt mtu
The nftables wiki notes that MSS can differ in each direction, so make sure the rule sees both the SYN and the SYN-ACK. Clamping helps only TCP; UDP applications still need working PMTUD or smaller packets.
Testing the MTU with ping
Send a ping with Don't Fragment set and a payload that makes the packet exactly the size you want to test. Payload = MTU − IP header − 8 bytes of ICMP header:
- IPv4, 1,500 MTU: 1,500 − 20 − 8 = 1,472
- IPv6, 1,500 MTU: 1,500 − 40 − 8 = 1,452
- IPv4, 9,000 MTU: 9,000 − 20 − 8 = 8,972
# Linux (iputils): -M do sets DF and refuses to fragment
ping -M do -s 1472 -c 4 host.example.net
ping -6 -M do -s 1452 -c 4 host.example.net
ping -M do -s 8972 -c 4 host.example.net
# Windows: /f sets Don't Fragment (IPv4 only), /l sets the data size
ping /f /l 1472 host.example.net
If the full-size ping fails and a smaller one works, reduce the size until it passes; that size plus 28 (IPv4) or 48 (IPv6) is your path MTU. ESnet's own jumbo-frame tests use slightly smaller sizes (8,940 for IPv4 and 8,900 for IPv6) to leave some margin. On Linux, tracepath reports the path MTU hop by hop:
tracepath -n host.example.net
If tracepath stalls without reporting a lower MTU, ICMP is probably being blocked somewhere, which is exactly the black hole situation described above.
Sources
- RFC 894: Transmission of IP Datagrams over Ethernet Networks
- RFC 791: Internet Protocol
- RFC 8200: IPv6 Specification
- RFC 768: User Datagram Protocol
- RFC 1191: Path MTU Discovery
- RFC 9293: Transmission Control Protocol
- RFC 4638: PPPoE MTU/MRU greater than 1492
- RFC 4821: Packetization Layer Path MTU Discovery
- MTU issues, ESnet fasterdata
- IP sysctl documentation, Linux kernel
- iptables-extensions(8), TCPMSS target, man7.org
- Mangling packet headers, nftables wiki
- ping(8) manual page (iputils), man7.org
- ping command, Microsoft Learn
- tracepath(8) manual page, man7.org