Avoiding fragmentation: How to find the path MTU

TCP/IP When a packet is traversing a network and encounters a segment that has an Maximum Transmission Unit MTU smaller than the size of the packet, the packet will be fragmented into two or more packets, each with its own IP header. This creates inefficiencies in the network due to the fact that the packet has to be reassembled at the destination, and the fact that each fragment has a higher header-to-payload ratio.

If— when taking a TCPDUMP you are seeing a high number of fragmented packets, it’s likely worthwhile to reduce the size of your MTU. But the question is: By how much?

First, you’ll need to figure out what the Path MTU is. The Path MTU is the largest MTU packet that can traverse a network without being fragmented.

An easy way to do this is to send pings of various sizes with the DF (Don’t Fragment) bit set. For example, if you would like to send 1400 byte pings from a Unix box the command would be:

ping -s 1400 -M do desination IP  

Where -s sets the size of the ICMP packet, and -M do sets the DF bit to 1

If you get replies, increase the size of the packet until you start to receive “Frag needed” errors. The largest allowable packet size that does not generate a “Frag needed” error indicates the Path MTU. Set the MTU on your client machine to be slightly smaller than the Path MTU to help prevent your packets will not be fragmented en-route to their destination.

Good Luck!

Hassan El-Masri

Network Consultant Engineer

comments powered by Disqus