you can send a specific mtu size with ping
ping -M do -s <mtu-size> <ip-address>
<ip-address>
being the local ip of the interface you wish to check.
Note there is an additional 28 bytes as a header when using this method.
Just keep increasing the mtu size (in the ping
command) until you get a Message too long
error or similar.
Current MTU setting and IP:
[root@centos7 ~]# ip l | grep ens37 | awk '{print $4,$5}'
mtu 1500
[root@dev-worker1 ~]# ip addr show ens37 | grep "inet " | awk '{print $2}'
10.10.10.10/24
sending a packet larger than the current MTU setting, but is still accepted:
[root@centos7 ~]# ping -M do -s 8972 10.10.10.10
PING 10.10.10.10 (10.10.10.10) 8972(9000) bytes of data.
8980 bytes from 10.10.10.10: icmp_seq=1 ttl=64 time=0.103 ms
8980 bytes from 10.10.10.10: icmp_seq=2 ttl=64 time=0.067 ms
Sending one too large. Some distros may actually tell you the maximum via this method. E.g Centos7:
[root@centos7 ~]# ping -M do -s 118972 10.10.10.10
Error: packet size 118972 is too large. Maximum is 65507
Once done, you can set it to the maximum if that's what you desire using ip link
ip link set <interface name> mtu <mtu value>
edit:
- Clarified I'm referring to pinging a local IP and provided example.
- I do not know for sure that some distros will output the actual limit, as my testing environment interfaces have max capabilities of 65535 bytes.