Lesson 3 of 18 · 18m
MTU, Fragmentation, and the Upload That Dies at 1500 Bytes
Path MTU discovery, the ICMP black hole that stalls bulk transfers, and MSS clamping at tunnel edges.
The SSH session works. curl health checks work. Then someone tries a 2 MB upload through the new WireGuard tunnel and the transfer stalls halfway through, every time, at what looks like the same point. Small packets fine, big packets dead — that signature has exactly one common cause, and it's not "the VPN is slow." It's the MTU, and the ICMP message that was supposed to explain it got eaten by a firewall.
The ceiling nobody set
Every link has a Maximum Transmission Unit — the biggest frame it can carry. Ethernet's is 1500 bytes, which is why the IPv4 header (20) plus TCP header (20) leaves a 1460-byte MSS — the largest TCP payload a normal connection advertises. TCP segments your byte stream to fit the MSS, so you never think about packet size. The trap: the MTU that matters is the smallest link MTU on the whole path, and nothing on that path is obliged to tell you what it is — unless something generates the error.
Jumbo frames (MTU 9000) exist inside datacenters and VPCs, and they're why bulk transfers between two hosts on the same segment fly while the same transfer through the internet gateway chugs: the path ceiling drops at the edge and somebody has to absorb the difference.
How fragmentation was supposed to work
IPv4's design: a router that can't forward a too-big packet may fragment it — slice it into pieces the receiver reassembles — unless the sender set the DF (don't fragment) flag, in which case the router drops the packet and mails back ICMP type 3 code 4, "fragmentation needed," containing the max MTU it could carry. The sender receives it, lowers its idea of the path MTU, and resends smaller. That's Path MTU Discovery (RFC 1191), and it works — when the ICMP actually arrives.
IPv6 deleted in-path fragmentation entirely: routers never fragment, only the source may, and every host must handle MTU ≥ 1280. The error report is ICMPv6 packet too big — which makes "just drop all ICMPv6" a complete outage, not a hardening step.
The black hole
PMTUD dies in one boring way: a middlebox — a firewall, a cloud security group, a "secure" config someone pasted — drops ICMP. Now:
- Client sends a 1400-byte segment toward a tunnel that can only carry 1350.
- The tunnel endpoint drops it and sends
fragmentation needed. - The ICMP dies in the firewall. The client never learns.
- TCP retransmits the same too-big segment. Forever. The connection "hangs," not "fails."
Meanwhile the handshake and every small request — under the ceiling — worked perfectly. That's the signature: fine for interactive traffic, stalls deterministically on bulk transfer. Diagnose it by probing with DF set:
ping -M do -s 1472 -c3 example.com # 1472 + 20 IP + 8 ICMP = 1500
ping -M do -s 1473 -c3 example.com # one byte over: dies or 'Frag needed'
tracepath -n example.com # reports pmtu along the way
ip link show dev wg0 # check the tunnel's own MTU-M do sets DF: either the packet goes through or the error tells you the real ceiling. ping -s 1392 succeeding where 1464 fails on a WireGuard link is your 1420-byte WireGuard MTU making itself known.
The tunnels that shrink your ceiling
Every encapsulation spends bytes: WireGuard's default MTU is 1420 (the kernel budgets ~80 bytes of overhead for IPv4 + UDP + the WireGuard envelope, plus margin), IPsec lands around 1400, GRE spends 24, VXLAN spends 50, PPPoE gives you 1492. The moment any tunnel is in your path, "1500 end to end" is wrong, and the tunnel endpoints will generate frag-needed ICMP that will get dropped by somebody's firewall.
The production fix is ugly but standard: MSS clamping. Rewrite the TCP MSS option on SYNs at the tunnel edge so both sides negotiate a size that fits, never needing fragmentation at all:
iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN \
-j TCPMSS --clamp-mss-to-pmtu
# nftables equivalent:
nft add rule inet filter forward tcp flags syn tcp option maxseg size set rt mtuThe practice
- Symptom first: small works, large stalls → test MTU before blaming loss, TLS, or the app.
- Never filter all ICMP. Filter types: rate-limit echo, drop redirects, allow unreachable and frag-needed. On IPv6,
packet too bigis non-negotiable. - When a tunnel joins the path, match MTUs on purpose: either clamp MSS at the edge or set the tunnel MTU to the real ceiling and verify with
ping -M do. ping -M do -s Nfrom both directions. Path MTU can be asymmetric; test it that way.
Was this lesson helpful?
Keep reading
Related articles from the SudoSecurity blog.
What is a Web Server? Apache, Nginx, and How the Internet Delivers Web Pages
A web server accepts HTTP requests and returns responses. Apache has been doing this since 1995. Nginx rebuilt the model in 2004 and took over the cloud. Here's how they work, how they differ, and how to pick between them.
How to Install NGINX on Debian & Ubuntu: Server Blocks, HTTPS and Reverse Proxy
When it comes to running a web server for all of my online projects, NGINX is the first that comes to mind for me. By default, it follows my guidelines of running a piece of software – meaning that the software is security-minded, performance-driven, and honestly, really easy to manage all the aspects of it. NGINX is most likely the most popular web server software in the world, and it's well known for being the backbone of some of the biggest sites on the internet to date. It is a lightweight
Minecraft 26.4 Replaced Its Decade-Old Login Crypto. Here's What key-rotation-period-seconds Actually Does.
26.4 Snapshot 9 rewrote how a Java Edition client and server agree on an encryption key. RSA-1024 is out, X25519 is in, and a new key-rotation-period-seconds setting decides how often the server's key changes. I opened the snapshot server jar, timed the login crypto, and checked what changes for...
The Same Researcher Broke apt the Same Way Twice, Seven Years Apart
In 2019 Max Justicz showed apt would install a package an attacker swapped in over a redirect. In November 2026 he did it again, CVE-2026-109518, through a different door that ends in the same place: code as root from a man in the middle. The fix shows how apt reuses files on disk.