Opscraft
The TCP handshake · Lesson 7 of 8 · 3 min read

IP TTL, traceroute and MSS clamping

IP TTL (not DNS TTL)

Every IP packet carries a TTL (time to live) — really a hop count. Each router decrements it; at 0 the router drops the packet and sends back ICMP "time exceeded". This prevents routing loops from circulating packets forever. Typical starting values: 64 (Linux), 128 (Windows), 255 (network devices) — so a received TTL of 58 suggests a Linux host 6 hops away.

How traceroute works

traceroute sends probes with TTL = 1, 2, 3...; each router where the TTL expires replies with ICMP time exceeded, revealing itself and the round-trip time to it. Linux traceroute uses UDP probes by default, Windows tracert uses ICMP echo, and traceroute -T -p 443 (or tcptraceroute) uses TCP SYNs — the best choice through firewalls that drop UDP/ICMP. * * * lines mean that hop didn't answer — not necessarily a problem if later hops respond. mtr combines traceroute and ping continuously to show per-hop loss.

MSS clamping and PMTUD

When a tunnel or VPN reduces the path MTU (IPsec, GRE, VXLAN, some Direct Connect/VPN setups), full-size TCP segments won't fit. Ideally Path MTU Discovery adjusts — but it depends on ICMP "fragmentation needed" messages that firewalls often block, creating black holes: the handshake works (small packets), bulk data hangs. MSS clamping rewrites the MSS option in SYN packets at the tunnel edge (iptables ... --clamp-mss-to-pmtu) so endpoints never send segments too big for the tunnel. AWS Site-to-Site VPN, for example, recommends MSS clamping on the customer gateway.