brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ping -M do -s 1472 finds the path MTU without fragmentation

Linux
~/tips/tip-networking-ping-m-do-path-mtu

ping -M do -s 1472 -c 3 example.com

Sends pings with the don't-fragment flag set, so you can find the largest packet that passes.

A VPN, a tunnel or a PPPoE line can quietly lower the MTU, and then some sites hang while others load. ping can find the limit.

ping -M do -s 1472 -c 3 example.com

-M do sets the Don’t Fragment flag, so a packet that is too large is rejected instead of being split. -s is the number of data bytes. The ICMP header adds 8 bytes and the IPv4 header adds 20, so 1472 bytes of data gives a 1500 byte packet, the usual Ethernet MTU.

If the replies come back, the path carries 1500. If you get an error such as message too long, lower the size and try again until it works. The largest size that passes plus 28 is your path MTU.

ping -M do -s 1400 -c 3 example.com

With an IPv6 target, the header is 40 bytes, so the sum is different: 1452 bytes of data fills 1500.

The caveat is that the test depends on ICMP making it through. Some firewalls drop ICMP, and then a failure looks like silence, which is not the same as a size problem. Try a smaller size first to check that plain ping works at all. Also, this form is from the Linux iputils version of ping. The macOS and Windows ping tools use different flags for the same job.

Further reading: ping(8) manual page, iputils

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link