Networking & DNS Bug Report

Small requests worked over the VPN, large responses hung forever: an MTU black hole

Through the new site-to-site VPN, health checks and small API calls succeeded, but any response over a few kilobytes stalled until timeout. TCP connected, then transfers hung. The cause was a smaller MTU inside the tunnel and blocked ICMP. How we proved it with ping and tcpdump, and fixed it with MSS clamping.

Tobias Brandt Tobias Brandt @tobiasbrandt · November 29, 2026 · 7 min read · 44 Views
Banner: large packets disappearing in a VPN tunnel with a smaller MTU

We connected an office network to our cloud VPC with a new site-to-site IPsec VPN, so staff could use internal tools without a client VPN. The tunnel came up, routes looked right, and the monitoring check (an HTTP GET to a health endpoint) passed. Then people started using it.

The pattern from users was consistent and strange:

  • The internal wiki's login page loaded. After logging in, pages stalled half-rendered.
  • ssh to servers connected, and the prompt appeared. Running ls in a big directory froze the session.
  • Some HTTPS sites failed during the TLS handshake; others worked.

From an office machine:

curl -s -o /dev/null -w "%{http_code} %{size_download}\n" https://wiki.internal.example.com/health
200 2
curl -v -o /dev/null https://wiki.internal.example.com/static/app.js
*   Trying 10.40.2.15:443...
* Connected to wiki.internal.example.com (10.40.2.15) port 443
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
  (hangs, then after 5 minutes)
* OpenSSL SSL_read: Connection reset by peer, errno 104

Small responses: fine. Anything large, including some TLS handshakes with long certificate chains: stuck. "Small works, large hangs" is the classic sign of a packet size problem.

Finding the size that fails

ping with the "do not fragment" flag set lets you send packets of an exact size and see whether they get through. On Linux, -M do sets DF and -s sets the payload size (the IP packet is 28 bytes larger: 20 for the IP header, 8 for ICMP):

ping -M do -s 1472 -c 3 10.40.2.15
PING 10.40.2.15 (10.40.2.15) 1472(1500) bytes of data.
--- 10.40.2.15 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss
ping -M do -s 1360 -c 3 10.40.2.15
1368 bytes from 10.40.2.15: icmp_seq=1 ttl=62 time=11.8 ms

Searching between them, the largest packet that got through was 1,400 bytes (payload 1372). Anything bigger disappeared silently. No error came back, which is what makes this a "black hole".

tcpdump on the server side

On the wiki server, during a stalled request:

sudo tcpdump -ni eth0 host 10.10.8.42 and port 443
10:22:01.100 IP 10.10.8.42.51812 > 10.40.2.15.443: Flags [S], ..., options [mss 1460,...]
10:22:01.101 IP 10.40.2.15.443 > 10.10.8.42.51812: Flags [S.], ..., options [mss 1460,...]
10:22:01.112 IP 10.10.8.42.51812 > 10.40.2.15.443: Flags [.], ack 1
10:22:01.113 IP 10.10.8.42.51812 > 10.40.2.15.443: Flags [P.], length 517     (ClientHello)
10:22:01.114 IP 10.40.2.15.443 > 10.10.8.42.51812: Flags [.], length 1448     (part of ServerHello + cert)
10:22:01.114 IP 10.40.2.15.443 > 10.10.8.42.51812: Flags [.], length 1448
10:22:01.330 IP 10.40.2.15.443 > 10.10.8.42.51812: Flags [.], length 1448     (retransmission)
10:22:01.770 IP 10.40.2.15.443 > 10.10.8.42.51812: Flags [.], length 1448     (retransmission)
...

Both ends advertised an MSS of 1460 in the SYN packets, based on their local 1500 byte MTU. The server sent full 1448 byte segments (1460 minus TCP options), which became 1500 byte IP packets. Those never arrived at the client; the server retransmitted them forever. The client's small packets got through fine.

MTU and tunnels

Each network link has a maximum transmission unit (MTU), the largest IP packet it carries without fragmentation. Ethernet's is usually 1,500 bytes. A VPN tunnel wraps every packet in extra headers: for IPsec ESP in tunnel mode with NAT traversal, a new outer IP header, a UDP header, the ESP header, an IV, padding and an integrity check, adding roughly 60 to 80 bytes depending on the cipher. To fit inside the 1,500 byte underlying network, the packets going into the tunnel must be smaller, in our case at most 1,400 bytes.

Path MTU discovery, and how it breaks

TCP does not know the tunnel exists. It picks segment sizes from the MSS exchanged in the handshake, which each side derives from its own interface MTU (1500, so MSS 1460). To learn about smaller links along the way, hosts use path MTU discovery (PMTUD): they send packets with the "don't fragment" bit set, and a router that cannot forward a packet because it is too big drops it and sends back an ICMP "fragmentation needed" message (type 3, code 4) stating the smaller MTU. The sender then reduces its packet size.

That only works if the ICMP message reaches the sender. Our cloud network's security group for the wiki servers allowed TCP 443 and 22 inbound and nothing else, so the ICMP "fragmentation needed" messages from the VPN gateway were dropped. The server never learned it should send smaller packets. It kept sending 1,500 byte packets into a path that silently dropped them.

Small requests and responses never needed full-size packets, which is why health checks, login pages and SSH prompts worked.

Environment

Item Value
Tunnel site-to-site IPsec (IKEv2, AES-GCM, NAT-T), office firewall to cloud VPN gateway
Effective MTU through tunnel 1,400 bytes
Hosts interface MTU 1,500, advertising MSS 1,460
ICMP blocked inbound by cloud security groups

1. Clamp the TCP MSS at the tunnel edge

The standard fix for TCP over tunnels is MSS clamping: the device at the tunnel entrance rewrites the MSS option in passing SYN packets to a value that fits the tunnel. Both sides then send segments small enough, without needing PMTUD at all.

On the office side, the firewall was Linux-based, so the rule was:

iptables -t mangle -A FORWARD -o vti0 -p tcp --tcp-flags SYN,RST SYN \
  -j TCPMSS --set-mss 1360

1360 is the tunnel MTU (1400) minus 20 bytes of IP header and 20 bytes of TCP header. Some guides use --clamp-mss-to-pmtu, which derives the value from the outgoing interface's MTU; that works if the tunnel interface's MTU is set correctly (1400), which ours was not at first. We set both: the tunnel interface MTU to 1400 and the explicit clamp.

The cloud provider's VPN gateway documentation recommended the same value (an MSS of 1,360 or lower for its IPsec tunnels), and its gateway also clamps on its side.

After the change, tcpdump on the server showed:

10:41:07.201 IP 10.10.8.42.52101 > 10.40.2.15.443: Flags [S], ..., options [mss 1360,...]
10:41:07.214 IP 10.40.2.15.443 > 10.10.8.42.52101: Flags [.], length 1348

The server sent 1,348 byte segments, which fit, and the transfer completed.

2. Allow the ICMP that PMTUD needs

MSS clamping only helps TCP. UDP-based protocols (DNS over large responses, QUIC, some VoIP) still rely on PMTUD or their own probing. We updated the security groups to allow ICMP type 3 (destination unreachable), including code 4 (fragmentation needed), from the VPC and VPN ranges. Blocking all ICMP is a common hardening step that breaks networking in exactly this way; type 3 messages are needed for correct operation.

For IPv6 the equivalent is ICMPv6 "Packet Too Big" (type 2), which must never be blocked, because IPv6 routers do not fragment packets at all.

3. Monitor with a large packet, not a small one

The health check that said the tunnel was up used a tiny response. We replaced it with a check that downloads a 64 KB file through the tunnel and a DF ping at 1,400 bytes, so an MTU problem fails the check immediately.

1. DF ping at the expected limit.

ping -M do -s 1372 -c 3 10.40.2.15    # 1400-byte packets
3 packets transmitted, 3 received, 0% packet loss

2. Large transfers.

curl -s -o /dev/null -w "%{http_code} %{size_download} %{time_total}\n" \
  https://wiki.internal.example.com/static/app.js
200 1843211 0.412

3. Applications. The wiki rendered fully, SSH sessions stayed responsive for large outputs, and every TLS site that had failed now completed its handshake. Over the following week, no stalled-connection reports.

4. PMTUD works too. With MSS clamping temporarily removed in a test, and ICMP now allowed, a large download stalled for under a second while the server received "fragmentation needed", lowered its path MTU, and continued. Clamping avoids even that delay, so we kept both.

5. Security implications. Allowing ICMP type 3 does not meaningfully increase exposure, and the security groups still block echo requests from outside our ranges. Silent failures like this are also a reliability risk for security tooling: our log shipper over the VPN had been losing large batches without error. It now confirms delivery and alerts on backlog.

Takeaways

  • "Small works, large hangs" over a tunnel usually means an MTU problem.
  • Find the limit with ping -M do -s <size>; packets above it vanish without an error.
  • Path MTU discovery needs ICMP "fragmentation needed" (ICMPv6 "Packet Too Big"); do not block it.
  • Clamp TCP MSS at the tunnel edge to the tunnel MTU minus 40, and set the tunnel interface MTU correctly.

References: RFC 1191, Path MTU Discovery, RFC 4821, Packetization Layer Path MTU Discovery, iptables-extensions TCPMSS target, AWS Site-to-Site VPN customer gateway requirements.

Add a label

#tcp #vpn #mtu #pmtud #mss-clamping
Written by
Tobias Brandt @tobiasbrandt

I work as a platform engineer supporting product teams who want to ship without becoming infrastructure experts. That means a lot of Dockerfiles, Kubernetes manifests, CI pipelines and the Linux and network details underneath them. The problems I write about are the ones new and experienced engineers both hit: a non-root pod that cannot write its volume, a pipeline that deployed an older commit, a merge that dropped a teammate's fix, files nginx cannot read, large responses that hang over a VPN, a DNS record that broke mail. I explain each one from the error message down to the mechanism, then show the fix and a quick way to check it. Where a topic is a fundamental, like Kubernetes objects, I teach it through one broken deploy rather than a list of definitions.

Advertisement

Comments

0

No comments yet. Be the first to comment!

Sign In to post a comment.