MTU
This page will be about MTU, it is currently work in progress.
What is my MTU?
If you can ping a box, you can check what the largest packet size you can get to it is.
For example:
ping -c1 -M do -s 1472 81.187.81.187
^^ That's the ping command to remember. The rest of this section is a bit of info about that command.
Use the path discovery options to ping. The option is -M. See the man page for all the options.
When setting size in ping, the size is the payload size - not the full packet size. The full packet size is payload + ICMP header size (28 bytes). The option for payload size is -s.
In these examples, we've only used a count of one ping using the -c option.
Note: ping is slightly different on different operating systems.
Two quick examples:
Checking if you really have 1500 MTU:
% ping -c1 -M do -s 1472 81.2.100.169 PING 81.2.100.169 (81.2.100.169) 1472(1500) bytes of data. 1480 bytes from 81.2.100.169: icmp_req=1 ttl=59 time=12.4 ms
--- 81.2.100.169 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 12.491/12.491/12.491/0.000 ms
Checking if you have smaller than 1500 MTU:
% ping -c1 -M do -s 1472 81.187.213.39 PING 81.187.213.39 (81.187.213.39) 1472(1500) bytes of data. From 90.155.53.53 icmp_seq=1 Frag needed and DF set (mtu = 1492)
--- 81.187.213.39 ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
That error says "Frag needed and DF set (mtu = 1492)". So, with an MTU of 1492 we would want a payload of 1464:
% ping -c1 -M do -s 1464 81.187.213.39 PING 81.187.213.39 (81.187.213.39) 1464(1492) bytes of data. 1472 bytes from 81.187.213.39: icmp_req=1 ttl=59 time=29.5 ms
--- 81.187.213.39 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 29.595/29.595/29.595/0.000 ms
Yay a reply! To double check, lets try one byte larger:
% ping -c1 -M do -s 1465 81.187.213.39 PING 81.187.213.39 (81.187.213.39) 1465(1493) bytes of data. From 90.155.42.36 icmp_seq=1 Frag needed and DF set (mtu = 1492)
--- 81.187.213.39 ping statistics --- 0 packets transmitted, 0 received, +1 errors
Yep, 1465 is too large a payload. It's interesting that the error is from itself (90.155.42.36) that time. The machine we sent the ping from must have received and remembered the ICMP error!