Checking maximum MTU
Lower than possible MTU is suboptimal, higher is flaky and may break networking completely. How to find the right value?
Just ping it?
Simple command line
Here’s a slightly time intensive way that uses a tool you should already have at hand, ping.
ping -M do -c 8 -v -n 126.96.36.199 -s 1464
Ping sends a packet across the network and lets you know how quickly it go there. Here to find the “maximum transfer unit” (MTU) we adjust the size of the packet and check to see if it needs to be broken up (“fragmented”) in order to travel over the network.
What’s that all mean then?
- Ping is the tool’s name.
- “-M do” says we want to avoid fragmentation.
- “-c 8” limits the count of packets to 8 (otherwise on Linux/Ubuntu one has to abort the tool with ctrl+c, or similar).
- “-v” verbose
- “-n 188.8.131.52” tells ping we don’t need to resolve the domain names involved and that the IP address we want to ping, send our packet to, is 184.108.40.206 [which is Google’s free DNS address].
- “-s 1464” states how many bits we’re going to send.
You basically want to adjust the 1464 until you get the highest possible number that doesn’t produce a warning/error stating that fragmentation is needed. For me, setting “-s 1600” (or anything over 1464) I get for example:
From 192.168.1.2 icmp_seq=1 Frag needed and DF set (mtu = 1500)
as lines in the ping output (emphasis added).
MTUs vary a lot. I’d start with 1400, try 1500; if you’re above 1500 or below 1400 then try double/half, other wise do interval bisection to find the best value. There’s nothing especially wrong with a lower value than you’re capable of setting successfully it’s just that it will be slightly less optimal.
Other notes on MTU
- There are systems allowing very large packets, so MTUs of several thousand are possible for some.
- The MTU depends on the route, not just the endpoints.
- Your ISP should be able to give details; distros or a Google/Bing search will show how to make your settings permanent.