basforge

Search titles, text and the “If it doesn’t work” cases.

    RU

    MTU blackhole: keep ICMP errors open and enable MSS clamping

    When SSH or HTTPS over a VPN or PPPoE connects fine but hangs solid on large responses, 1500-byte packets with the DF flag are getting lost on a narrower hop with no ICMP reply coming back. Leave the required ICMP types open in the firewall and enable MSS clamping on the router ahead of the tunnel.

    Why only large traffic breaks

    Standard Ethernet carries frames with an MTU of 1500 bytes, and TCP sets the DF (Don’t Fragment) flag on outbound packets. A tunnel or PPPoE adds its own header and shrinks the usable MTU:

    Link Typical MTU Max TCP MSS (IPv4) Payload size for ping -M do -s
    Standard Ethernet 1500 1460 1472 (1500 − 20 IP − 8 ICMP)
    ISP PPPoE 1492 1452 1464
    WireGuard over IPv4 1420 1380 1392
    IPSec / GRE tunnel 1400 1360 1372

    Small packets — TCP SYN, typed SSH commands, default 56-byte ping — stay well below 1372 bytes and pass without trouble. As soon as the server sends a full segment (a TLS certificate, ls -la output, an HTML page), the router before the tunnel drops it and sends back ICMP Fragmentation Needed (Type 3 Code 4 in IPv4, or Type 2 Packet Too Big in IPv6). If a firewall along the path drops ICMP, the sender never learns about the narrower link and keeps retransmitting the same 1500-byte packet until the session dies (ICMP and MTU).

    What to do

    1. Do not block control ICMP in your firewall. In nftables, ct state established,related accept allows ICMP errors tied to open connections automatically; on IPv6, also allow packet-too-big (nftables, IPv6 in practice).
    2. Turn on MSS clamping on the router ahead of the tunnel or PPPoE link. The router rewrites the MSS option inside SYN packets so both endpoints size segments to fit from the first packet, even when an upstream firewall drops ICMP:
    # nftables on a Linux router (in the forward chain):
    tcp flags syn tcp option maxseg size set rt mtu

    On MikroTik, a change-mss rule with new-mss=clamp-to-pmtu in /ip firewall mangle does the same job (MikroTik firewall).

    How to check

    Find the unfragmented ceiling by stepping -s down until ping replies:

    ping -M do -c 1 -W 1 -s 1472 203.0.113.10
    ping -M do -c 1 -W 1 -s 1392 203.0.113.10

    Or run tracepath -n 203.0.113.10 — it lowers the size automatically and prints pmtu 1420 at the hop where the link narrows. Check the kernel’s cached Path MTU with ip route get 203.0.113.10.

    Also in this chapter