Finding and Fixing Path MTU Black Holes on WireGuard Tunnels
Bottom line: A WireGuard tunnel that works fine for SSH but hangs on large transfers is almost always a path MTU black hole, and you fix it by clamping TCP MSS to fit inside the tunnel, not by lowering the interface MTU and hoping.
I hit this on a site-to-site link between two Proxmox hosts where the underlay crossed a PPPoE DSL circuit. Small packets flowed, scp of anything larger than a few hundred kilobytes stalled, and ping -M do from one side to the other failed at 1421 bytes. WireGuard itself was healthy — handshakes completed, wg show reported a recent handshake, and the tunnel interface was up with mtu 1420. The problem was that the underlay path could only carry 1492 bytes of IP payload, and something in the middle was dropping the ICMP Fragmentation Needed messages that should have told the sender to shrink its packets.
Why WireGuard tunnels break PMTU
WireGuard is a UDP protocol. Each tunnel packet is an outer UDP datagram carrying an encrypted inner IP packet. The overhead is fixed: 20 bytes outer IPv4, 8 bytes UDP, 32 bytes WireGuard header and authentication tag, plus 16 bytes for the Poly1305 tag. That’s 60 bytes of overhead for IPv4 outer, 80 for IPv6 outer. The default interface MTU of 1420 is chosen to fit inside a 1500-byte Ethernet path with IPv6 outer headers.
The failure mode is classic PMTUD. A TCP sender inside the tunnel starts with an MSS derived from the tunnel interface MTU (1420 − 40 = 1380 for IPv4). It sends a 1420-byte packet. WireGuard encapsulates it into a 1480-byte UDP datagram. If the underlay path MTU is 1492, that fits. If the underlay path MTU is 1480 (common on some PPPoE and IPsec paths), the packet is too big, the router generates ICMP Type 3 Code 4, and — if that ICMP is filtered, rate-limited to death, or dropped because the router doesn’t have a route back to the tunnel’s inner address — the sender never learns. It keeps retransmitting the same too-big segment. The connection stalls.
RFC 8899 calls this out directly: classical PMTUD “is subject to protocol failures” when traffic larger than the actual PMTU is black-holed. WireGuard has no built-in PMTUD of its own; it relies on the outer UDP stack to handle it, and the outer stack’s ICMP handling is exactly what fails in practice.
Reproducing it
Set up two hosts with a WireGuard link where the underlay MTU is smaller than the tunnel MTU plus overhead. On a lab pair I used a Linux bridge with mtu 1480 between the two physical NICs to simulate the constrained path.
Confirm the tunnel is up:
1 | wg show wg0 |
Then test with DF set. From host A’s tunnel address to host B’s:
1 | ping -M do -s 1372 -c 3 10.10.0.2 |
1372 bytes of payload plus 28 bytes of ICMP/IP headers = 1400 bytes on the wire inside the tunnel, which encapsulates to 1460 on the underlay. That succeeds. Bump it:
1 | ping -M do -s 1392 -c 3 10.10.0.2 |
1392 + 28 = 1420, which encapsulates to 1480 — exactly the underlay MTU. Depending on the bridge’s behaviour this may pass. Try 1393:
1 | ping -M do -s 1393 -c 3 10.10.0.2 |
This produces 1421 bytes inside, 1481 on the underlay. It fails with ping: local error: message too long, mtu=1420 if the kernel catches it locally, or silently times out if it leaves the box and gets dropped in the path. The silent timeout is the black hole.
Watch it with tcpdump on the underlay interface of host A:
1 | tcpdump -ni eth0 -vv 'udp port 51820' -c 20 |
You’ll see the 1481-byte UDP datagrams leave and nothing come back. On the router in the middle, if you have access, you’ll see the ICMP Type 3 Code 4 generated and then dropped or rate-limited. On host A, tcpdump -ni wg0 'icmp' shows nothing — the PTB never made it back.
Then reproduce with TCP. Start an iperf3 server on host B and run a client from A:
1 | iperf3 -c 10.10.0.2 -t 10 |
Throughput collapses to a few hundred kbit/s or stalls entirely after the first window. That’s the signature.
The fix: clamp MSS
The correct fix is to clamp the TCP MSS on packets entering the tunnel so that the resulting TCP segments, once encapsulated, fit inside the underlay path MTU. This is what every VPN concentrator does and it’s what you should do on any WireGuard endpoint that terminates TCP.
With iptables (1.8.13 on the hosts I tested):
1 | iptables -t mangle -A FORWARD -o wg0 -p tcp --tcp-flags SYN,RST SYN \ |
--clamp-mss-to-pmtu reads the outgoing interface MTU (1420 on wg0) and sets MSS to MTU − 40 for IPv4. That gives 1380, which encapsulates to 1440 on the underlay — comfortably inside 1480. If you want to be explicit rather than derive from the interface:
1 | iptables -t mangle -A FORWARD -o wg0 -p tcp --tcp-flags SYN,RST SYN \ |
1360 is a safe value for a 1480-byte underlay with IPv6 outer headers (1360 + 40 + 80 = 1480). Use --set-mss when you know the underlay is smaller than what the tunnel interface suggests, or when the tunnel MTU is set higher than the underlay can carry.
The nftables equivalent, which is what I’d use on anything running a recent kernel:
1 | nft add table inet mangle |
rt mtu sets the MSS option to the route MTU minus 40, same logic as --clamp-mss-to-pmtu. If you need the explicit value:
1 | nft add rule inet mangle forward oifname "wg0" tcp flags syn \ |
Apply the rule on both ends if traffic flows both directions, and on the FORWARD chain if the WireGuard endpoint is routing for other hosts. If the endpoint is a router for a subnet behind it, the rule needs to match traffic leaving the tunnel interface, which is what -o wg0 / oifname "wg0" does.
Lowering the tunnel MTU instead
The alternative is to set the WireGuard interface MTU low enough that the derived MSS is safe. If the underlay PMTU is 1480 and the outer header is IPv4 (60 bytes overhead), the tunnel MTU should be 1420. If the underlay is 1492 (PPPoE), the tunnel MTU should be 1432. If the underlay is 1400 (some MPLS and GRE paths), the tunnel MTU should be 1340.
1 | ip link set wg0 mtu 1340 |
This works, but it has two costs. First, every packet inside the tunnel now carries less payload, so you pay a throughput tax on every flow, not just the ones that would have hit the black hole. Second, it doesn’t help if the underlay PMTU changes — you’ve hardcoded a value that was correct at configuration time.
MSS clamping is better because it only affects TCP SYN packets, it adapts if you use --clamp-mss-to-pmtu or rt mtu, and it leaves the tunnel MTU at the standard value so UDP and ICMP traffic inside the tunnel can still use full-size packets where the path supports it.
Measured before and after
On the lab pair, with a 1480-byte underlay and a 10-second iperf3 run:
| Configuration | Tunnel MTU | MSS clamp | Throughput |
|---|---|---|---|
| Default | 1420 | none | 0.3–0.6 Mbit/s, frequent stalls |
| Tunnel MTU lowered | 1340 | none | 410–440 Mbit/s |
| MSS clamp to PMTU | 1420 | --clamp-mss-to-pmtu |
430–460 Mbit/s |
| MSS clamp explicit | 1420 | --set-mss 1360 |
430–460 Mbit/s |
The default case is the black hole: TCP gets a few segments through, then stalls on the first one that exceeds the path. Lowering the tunnel MTU and clamping MSS both recover full throughput; the clamp wins slightly because it doesn’t shrink the payload of every packet, only the MSS advertised in SYN. The difference is within run-to-run noise on this hardware, but the clamp is the configuration I’d ship because it doesn’t require knowing the underlay MTU in advance.
Pitfalls and how to diagnose them
ICMP is filtered somewhere in the path. This is the root cause of most black holes. Routers that rate-limit ICMP Type 3 Code 4 to a few per second will drop the PTB for a busy flow, and firewalls that block all ICMP will drop it entirely. Diagnose by running tcpdump -ni <underlay> 'icmp and icmp[icmptype] == 3' on the sender while a large transfer runs. If you see no PTB, the path is filtering it. The fix is MSS clamping, not trying to un-filter ICMP you don’t control.
The PTB arrives but has no route back. If the router generating the PTB can’t route to the inner tunnel address, it drops the message. This is common when the WireGuard endpoint is behind NAT. Diagnose by checking ip route get <inner-src> on the router that should be generating the PTB.
Asymmetric MTU. One direction of the path has a smaller MTU than the other. ping -M do from A to B succeeds at 1400 but from B to A fails at 1380. Diagnose by testing both directions with increasing sizes. Clamp MSS on both endpoints.
WireGuard’s own keepalive and handshake packets are fine. They’re small. Don’t be misled by a healthy wg show output — the tunnel can be up and still black-hole large packets.
Path MTU changes mid-flow. A route flap moves traffic onto a link with a smaller MTU. Classical PMTUD should recover, but if the PTB is lost, the flow stalls permanently. This is exactly the failure RFC 8899 was written to address; DPLPMTUD at the transport layer (QUIC does this) is more robust than relying on ICMP, but for TCP over WireGuard, MSS clamping is the practical mitigation.
IPv6 outer headers. If the underlay is IPv6, the overhead is 80 bytes, not 60. A tunnel MTU of 1420 gives an outer packet of 1500, which fits a 1500-byte path but not a 1480-byte one. Clamp to 1360 rather than 1380 in that case.
FAQ
Why does the tunnel work for SSH but not for file transfers?
SSH’s interactive traffic is small packets — keystrokes, terminal output — that fit well below the path MTU. File transfers use full-size TCP segments, which is where the black hole bites. The tunnel is fine; the large packets are not.
Can I just set the WireGuard MTU to 1280 and be done?
You can, and it will work, but you’re paying a 10% throughput tax on every packet for a problem that only affects TCP. 1280 is the IPv6 minimum and is a safe floor, but MSS clamping gives you the same reliability without shrinking every packet.
Does --clamp-mss-to-pmtu work if the underlay PMTU is smaller than the tunnel MTU suggests?
It reads the outgoing interface MTU, which is the tunnel MTU, not the underlay PMTU. If the underlay is smaller than the tunnel MTU minus overhead, the clamp will still produce an MSS that’s too large. Use --set-mss with an explicit value in that case, or lower the tunnel MTU to match the underlay.
Why doesn’t WireGuard do PMTUD itself?
WireGuard is a UDP protocol and relies on the outer IP stack for PMTUD. The project’s known limitations page notes that it makes trade-offs for simplicity; PMTUD is one of the things left to the layers below. RFC 8899 describes DPLPMTUD as a more robust alternative for datagram transports, but WireGuard doesn’t implement it.
Do I need the rule on both endpoints or just one?
Both, if traffic flows in both directions and both endpoints terminate TCP. The rule matches SYN packets leaving the tunnel interface, so it needs to be present wherever TCP sessions originate or are forwarded into the tunnel.
What about UDP traffic inside the tunnel — does MSS clamping help?
No. MSS clamping only rewrites the TCP MSS option in SYN packets. UDP applications that send large datagrams need to do their own PMTU discovery (QUIC does this per RFC 8899) or you need to lower the tunnel MTU so the application’s datagrams fit. For most homelab and small-office use, TCP is the traffic that matters and MSS clamping is sufficient.







