What you’ll get
Send a full unfragmented packet (-M do -s 1472) from a host with MTU 1500 through router 10.0.10.1, which
leads into a link with MTU 1400, and watch the Linux kernel discover the true path MTU:
ping -M do -c 2 -W 1 -s 1472 10.0.20.10
# PING 10.0.20.10 (10.0.20.10) 1472(1500) bytes of data.
# From 10.0.10.1 icmp_seq=1 Frag needed and DF set (mtu = 1400)
# ping: local error: message too long, mtu=1400
ip route get 10.0.20.10
# 10.0.20.10 via 10.0.10.1 dev eth0 src 10.0.10.10 uid 0
# cache expires 597sec mtu 1400
tracepath -n 10.0.20.10
# 1?: [LOCALHOST] pmtu 1500
# 1: 10.0.10.1 0.041ms
# 2: 10.0.10.1 0.010ms pmtu 1400
# 2: 10.0.20.10 0.017ms reached
# Resume: pmtu 1400 hops 2 back 2
The first packet reached the router and triggered an ICMP reply; the second packet was stopped locally by the
kernel because it had already cached mtu 1400 for 10 minutes. Here is the router’s reply in tcpdump -nn:
ICMP message types: what runs over IP
ICMP is an L3 control protocol (Protocol = 1 in the IPv4 header) with no port numbers. The ping utility uses
only one pair of messages, while error messages keep the rest of the network working:
| Type / Code | Name | When sent | Practical meaning |
|---|---|---|---|
8 / 0 |
Echo Request | ping command |
L3 reachability probe |
0 / 0 |
Echo Reply | Reply to ping |
Host is up and the return path to the client works |
3 / 0, 3 / 1 |
Net / Host Unreachable | No route or no ARP reply | Network has no route to the destination, or the neighbor is offline (MAC, switch, ARP, and VLAN) |
3 / 3 |
Port Unreachable | Closed UDP port | No process is listening on that UDP port (UDP counterpart to TCP RST) |
3 / 4 |
Fragmentation Needed | Packet exceeds MTU with DF set |
Carries Next-Hop MTU — the basis of Path MTU Discovery |
3 / 13 |
Administratively Prohibited | Firewall REJECT rule |
Packet was explicitly rejected by a firewall along the path |
11 / 0 |
Time Exceeded | TTL hit 0 |
Routing-loop protection and the engine behind traceroute and mtr (Routing and LPM) |
Blocking all ICMP on a firewall is a common mistake. If a server should not respond to ping, block only inbound
Type 8 (echo-request) and keep Type 3 and Type 11 open. In nftables, ICMP errors tied to existing
connections pass automatically via ct state related accept (nftables).
Path MTU Discovery and the MTU black hole
On the modern internet, IPv4 packets almost always go out with the DF (Don’t Fragment) flag set: in-path fragmentation loads intermediate routers, breaks stateless filters, and loses an entire packet when a single fragment drops. In IPv6, intermediate fragmentation is forbidden by the standard.
To let both endpoints learn the smallest MTU along the path — such as PPPoE 1492, WireGuard 1420, or IPSec
1400 (Packets and encapsulation) — hosts run Path MTU Discovery (PMTUD, RFC 1191):
- The client sends a 1500-byte packet with
DFset. - The router before the narrower link cannot forward it, drops it, and replies with ICMP
Type 3 Code 4carryingNext-Hop MTU(1400). - The client kernel caches
mtu 1400in the route cache for 10 minutes and shrinks subsequent segments to fit.
An MTU black hole happens when a firewall on the path silently drops ICMP Fragmentation Needed. The failure
pattern is unmistakable: small packets (TCP SYN/SYN-ACK, login prompt, default 56-byte ping) stay under
1400 bytes and sail through, whereas the first full 1500-byte packet (TLS certificate, long ls -la output, HTTP
body) vanishes at the router. The sender gets neither an error nor an ACK and keeps retransmitting until the
session times out.
- Client (MTU 1500)✓ 1500 B + DF
- Router (MTU 1400)✓ < ICMP need to frag
- Client cache✓ stored mtu 1400
- Server✓ packets ≤ 1400 arrive
18:55:48.084714 IP 10.0.10.10 > 10.0.20.10: ICMP echo request, id 4646, seq 1, length 1480 18:55:48.084729 IP 10.0.10.1 > 10.0.10.10: ICMP 10.0.20.10 unreachable - need to frag (mtu 1400), length 556
The router reported the narrow link’s exact MTU; the client kernel cached mtu 1400 for 10 minutes and lowered packet size.
ip route get 10.0.20.10 and tracepath -n 10.0.20.10
- Client (MTU 1500)✓ SYN and small packets
- Router (MTU 1400)✕ 1500 B + DF dropped
- Firewall (ICMP)✕ dropped Type 3 Code 4
- Server— hangs after Hello / ls
# Short ping passes, full 1500 B packet vanishes silently: ping -M do -c 2 -W 1 -s 1472 10.0.20.10 2 packets transmitted, 0 received, 100% packet loss
The Fragmentation Needed reply never reached the client: the kernel still assumes MTU 1500 and retries full-size packets endlessly.
ping -M do -c 1 -s 1372 10.0.20.10 (step -s down until it replies)
- Client✓ SYN [mss 1460]
- Router (nftables)✓ clamped mss to 1360
- Narrow link 1400✓ segments ≤ 1400 B
- Server✓ all 4096 B received
18:55:52.963196 IP 10.0.10.10.49398 > 10.0.20.10.9001: Flags [S], options [mss 1360,sackOK,…], length 0 18:55:52.963211 IP 10.0.20.10.9001 > 10.0.10.10.49398: Flags [S.], options [mss 1360,sackOK,…], length 0
The router lowered TCP MSS in SYN to 1360 (1400 − 40), so both peers send segments that fit the link even with ICMP blocked.
sudo nft list ruleset | grep maxseg
Diagnostics and fixes: ping -M do, MSS clamping, and tcp_mtu_probing
Find the real path MTU. In ping, -s sets only the ICMP payload size, so add 20 bytes for IPv4 and 8 bytes
for the ICMP header (+28 bytes total):
# Test standard Ethernet (1472 + 28 = 1500):
ping -M do -c 1 -s 1472 10.0.20.10
# If it silently drops, step down to common boundaries (1464 -> PPPoE 1492, 1392 -> WireGuard 1420, 1372 -> 1400):
ping -M do -c 1 -s 1372 10.0.20.10
# 1380 bytes from 10.0.20.10: icmp_seq=1 ttl=63 time=0.051 ms
The tracepath -n <IP> command (preinstalled on Ubuntu) automates this probe and prints the hop where pmtu
drops.
How to fix it on your router and server:
-
Keep required ICMP open. On every firewall you control, allow
ct state relatedanddestination-unreachable(frag-needed). -
Enable TCP MSS clamping on the router or VPN gateway. As
SYNpasses through, the kernel lowers TCPMSStoegress MTU − 40(IPv4;− 60for IPv6). Innftables, that is a single line in theforwardchain:table ip filt { chain forward { type filter hook forward priority 0; policy accept; tcp flags syn tcp option maxseg size set rt mtu } }For a
1400-MTU link, this rewritesmss 1460tomss 1360before data transfer starts, so TCP works even if someone else’s firewall drops all ICMP. -
Turn on PLPMTUD on the Linux server itself. Ubuntu 24.04 ships with
net.ipv4.tcp_mtu_probing = 0. When the black hole sits on an upstream network you cannot touch, setting it to1(RFC 4821) makes the server’s TCP stack probe smaller segment sizes automatically whenever a black hole is suspected.
If it doesn’t work
SSH or HTTPS over VPN or PPPoE connects and accepts short commands, then freezes completely on ls -la or page load
- Cause
- MTU black hole: short packets (
SYN, keystrokes) fit inside the tunnel MTU and go through, while the first full 1500-byte segment with theDFflag exceeds the link; the return ICMPFragmentation Needed(type 3, code 4) is blocked by a firewall. - Fix
- Measure the real path MTU with
ping -M do -c 1 -s 1472 <IP>(lowering the size until you get a reply) ortracepath -n <IP>. Allowct state relatedalong with the required ICMP types and turn on MSS clamping on the router (tcp flags syn tcp option maxseg size set rt mtu).
ping -M do -s 1472 10.0.20.10 returns Frag needed and DF set (mtu = 1400) the first time, then immediately prints local error: message too long, mtu=1400 on the second run
- Cause
- Normal Path MTU Discovery behavior: after the router’s first ICMP error, the Linux kernel cached
mtu 1400for that destination for 10 minutes and now rejects oversized packets before they even leave the interface. - Fix
- Check the cache with
ip route get 10.0.20.10(cache expires … mtu 1400). After changing a tunnel’s MTU, clear the cache withsudo ip route flush cache.
Blocked all ICMP on the firewall for stealth — and broke VPNs, large API responses, or mtr diagnostics
- Cause
- Dropping all ICMP cuts out
Fragmentation Needed(type 3, code 4) andTime Exceeded(type 11) alongsideping(type 8). In IPv6, blocking all ICMPv6 takes the network offline altogether. - Fix
- In
nftables, keepct state established,related accept(ICMP errors for active flows matchrelated) and explicitly allowdestination-unreachable,time-exceeded, andparameter-problem(nftables).
ping -M do -c 1 -s 1472 to an external server loses 100% of packets, while -s 1464 succeeds with no loss
- Cause
- The ISP link uses PPPoE: its 8-byte header comes out of the 1500-byte Ethernet frame, leaving a real MTU of 1492 (
1464 + 20 IPv4 + 8 ICMP = 1492). - Fix
- That ceiling is normal for PPPoE: confirm the router’s WAN interface has MTU 1492 and MSS clamping enabled (
1452for IPv4) so 1500-MTU LAN devices do not stall.
ping or tcpdump reports Port Unreachable or Communication Prohibited even though the traffic is not TCP
- Cause
- Different ICMP type 3 codes report the exact reason for refusal: code 3 (
Port Unreachable) means a closed UDP port; code 13 (Communication Administratively Prohibited) means a firewallREJECTrule stopped the packet. - Fix
- Inspect the error code in
tcpdump -nn icmp: code 13 points to a firewall along the path, while code 1 (Host Unreachable) points to no ARP reply on the destination segment.