MTU and MSS when large packets stall

Diagnose a path MTU black hole even when ping and DNS respond.

Small exchanges work and larger ones stall. SSH may connect but freeze while printing a big directory listing. Test packet size before treating the symptom as an application problem.

Why it happens

Encapsulation adds headers. If a router cannot forward a packet at its current size and the corresponding ICMP message is filtered, the sender cannot learn that it needs to use smaller packets.

Measure the path MTU

# Linux: prohibit fragmentation and vary the payload size
ping -4 -M do -s 1472 example.com   # 1472 + 28 = 1500
ping -4 -M do -s 1464 example.com   # 1492 is typical for PPPoE

# Windows
ping -4 -f -l 1472 example.com

tracepath example.com            # show discovered path MTU changes

Interpret the result

For IPv4 without options, a successful 1464-byte payload demonstrates that a 1492-byte packet made the trip, including IP and ICMP headers. If 1465 bytes also work, keep increasing the size. A timeout alone does not locate a bottleneck.

Record the largest successful payload, the smallest failed one and the exact error. A Frag needed message that includes the MTU gives more information than silence. The mechanism is specified in RFC 1191.

Ways to correct it

  1. Allow IPv4 ICMP fragmentation-needed and IPv6 ICMP Packet Too Big messages.
  2. Use TCP MSS clamping where a link reduces the MTU, if needed:
    # nftables
    table inet mangle {
      chain forward {
        type filter hook forward priority mangle;
        tcp flags syn tcp option maxseg size set rt mtu
      }
    }
    
    # MikroTik
    /ip firewall mangle add chain=forward protocol=tcp tcp-flags=syn \
        action=change-mss new-mss=clamp-to-pmtu passthrough=yes
  3. Set a lower MTU on the affected interfaces when that better represents the path.

With base headers, subtract 40 bytes from the MTU for IPv4 TCP or 60 bytes for IPv6 TCP. See the MTU calculator for common encapsulations.