Simple IPv4 Path MTU Discovery

Posted by Bradley | Uncategorized | Wednesday 21 October 2009 09:58

Sometimes you need to know the MTU of a path across a network, the MTU commonly changes for things like Q in Q or GRE tunnelling so its important to accurately know it to prevent undue fragmentation.

The middle bit in the 3 bit fragmentation flags field in the IP header is the Don’t Fragment (DF) flag, if it set to 1 the packet will not be fragmented, therefore if the packet exceeds the MTU of a link it will generate a ICMP type 3 code 4 error message and be dropped.

Using the extended commands in the ping we can manually determine the specific MTU across a path, there are a couple of pointers on doing this;

  1. Change the repeat count to 1 or it will sweep the entire range a default of 5 times which is usually unnecessary
  2. Don’t sweep the default range, it defaults to an MTU of between 36 to 18024 bytes, considering it sends 1 packer per byte of the MTU that’s 17,988 packets. That a hell of a lot of default 2 second time outs to wait for… so try a smaller range like 10 or so bytes
  3. Remember to set the DF bit in the IP header or the ICMP packets will fragment and you actually be testing the MTU
  4. Use the verbose option to see the results of each packet
  5. Change the sweep interval to 1, again there is little point in sweeping the range multiple times
Router#ping
Protocol [ip]:
Target IP address: 201.14.1.1
Repeat count [5]: 1
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]:
Set DF bit in IP header? [no]: yes
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]: Verbose
Loose, Strict, Record, Timestamp, Verbose[V]:
Sweep range of sizes [n]: y
Sweep min size [36]: 1495
Sweep max size [18024]: 1505
Sweep interval [1]:
Type escape sequence to abort.
Sending 11, [1495..1505]-byte ICMP Echos to 201.14.1.1, timeout is 2 seconds:
Packet sent with the DF bit set
Reply to request 0 (4 ms) (size 1495)
Reply to request 1 (4 ms) (size 1496)
Reply to request 2 (4 ms) (size 1497)
Reply to request 3 (4 ms) (size 1498)
Reply to request 4 (4 ms) (size 1499)
Reply to request 5 (8 ms) (size 1500)
Request 6 timed out (size 1501)
Request 7 timed out (size 1502)
Request 8 timed out (size 1503)
Request 9 timed out (size 1504)
Request 10 timed out (size 1505)
Success rate is 54 percent (6/11), round-trip min/avg/max = 4/4/8 ms
Router#

As shown in the example above it indicates that the maximum MTU along the path is 1500 bytes.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment