Linux MTU Discovery

Written by James McDonald

July 15, 2011

I keep having to Google how to discover the correct MTU for a link so I’m going to blog about it to save the effort.

The command to test for the MTU in Linux is:
ping -M do -s <bytes> <ip address>

First a succesful MTU test ping:

ping -M do -s 1372 10.30.30.11
PING 10.30.30.11 (10.30.30.11) 1372(1400) bytes of data.
1380 bytes from 10.30.30.11: icmp_req=1 ttl=63 time=88.5 ms
1380 bytes from 10.30.30.11: icmp_req=2 ttl=63 time=90.9 ms
1380 bytes from 10.30.30.11: icmp_req=3 ttl=63 time=90.0 ms

The above command is actually a ping down a PPTP tunnel. The default MTU for a PPTP connection in Windows is 1400 as you can see from the above I am using -s 1372 as the byte size because once you have to had a 28 byte header to get the 1400 bytes total which is the MTU (Maximum Transfer Unit).

Then you have to increase the -s parameter up until you see the following output. And then step down till it’s working again.

Now a ping with a packet size too big:

ping -M do -s 1373 10.30.30.11 
PING 10.30.30.11 (10.30.30.11) 1373(1401) bytes of data.
From 10.30.30.41 icmp_seq=1 Frag needed and DF set (mtu = 1400)
From 10.30.30.41 icmp_seq=1 Frag needed and DF set (mtu = 1400)
From 10.30.30.41 icmp_seq=1 Frag needed and DF set (mtu = 1400)
From 10.30.30.41 icmp_seq=1 Frag needed and DF set (mtu = 1400)

The packet will not pass.

Viewing the MTU of local linux connections:
From a terminal issue the /sbin/ifconfig command you can see the MTU listed in the output as follows.

/sbin/ifconfig
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.30.30.41  P-t-P:10.30.30.40  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1400  Metric:1
          RX packets:212 errors:0 dropped:0 overruns:0 frame:0
          TX packets:237 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:101633 (99.2 KiB)  TX bytes:39813 (38.8 KiB)

p4p1      Link encap:Ethernet  HWaddr F4:6D:04:92:76:7D  
          inet addr:10.254.239.100  Bcast:10.254.239.255  Mask:255.255.255.0
          inet6 addr: fe80::f66d:4ff:fe92:767d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:80676 errors:0 dropped:0 overruns:0 frame:0
          TX packets:91041 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:45961600 (43.8 MiB)  TX bytes:17869824 (17.0 MiB)
          Interrupt:45 Base address:0xa000 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...