Use Ping to Find a Path’s MTU
On occasion, you may want to find the MTU along a path. This might be to troubleshoot a WAN connection for example.
This is quite easy with ping.
How it Works
There are two parts to this; Setting the Don’t Fragment (DF) bit, and setting the packet size.
Here is an example of how to set ping’s packet size (in Windows; Other systems are similar):
The ‘l’ flag sets the size of the packet. Here, we’re setting it to 2000 bytes, which should be much larger than the MTU in my network.
The packet is still getting through to the destination due to fragmentation.
Now we can use the ‘f’ flag to set the DF bit:
Now we get a different result. We’re forcing routers along the path to drop the packet rather than fragment it.
This causes an ICMP error message to be returned, which we see here. Any time we see this error, the packet is larger than the path’s MTU
The flags shown here are for ping in Windows. Different flags will be used in Linux and other Operating Systems
Find the MTU
Now that we know how this works we can find the MTU using trial and error.
We lower the packet size until we find a value that doesn’t need to be fragmented.
We’re looking for the largest packet size that won’t return an error. Here, we can see that a packet size of 1473 is too large, but 1472 bytes is not.
On my network, 1472 bytes is the MTU.
Last Updated: [last-modified] (UTC)