In networking, the Maximum Transmission Unit (MTU) represents the largest size packet or frame that can be sent in a single transaction over a specific network. Incorrect MTU configurations can lead to performance issues like packet fragmentation, delays, or dropped packets. This article will guide you through understanding MTU and the methods to test and adjust MTU size in your network.
1. Using the Command Line Interface (CLI) – Ping Method
On Windows:
Open Command Prompt and type the following command:
ping destination_ip -f -l packet_size
For example, if you want to test a packet size of 1500 bytes:
ping 192.168.68.1 -f -l 1500
You can also see the current MTU size on Windows by typing on Command Prompt.
netsh interface ipv4 show subinterfaces
You can also set a new MTU size on Windows by typing command.
netsh interface ipv4 set subinterface interface_name mtu=size store=persistent
For example, if you want to set a packet size of 1500 bytes:
netsh interface ipv4 set subinterface Ethernet mtu=1500 store=persistent
There is also useful software that finds the maximum MTU size automatically. Thanks to Eli Ulkerson for this great project. You can access it by clicking here.
On Linux:
Open a terminal and type the following command:
ping destination_ip -M do -s packet_size
For example, to test with a packet size of 1500 bytes:
ping 192.168.68.1 -M do -s 1472
(1472 + 28 bytes overhead for ICMP headers equals 1500 bytes.)
Continue reducing the packet size until the ping goes through without fragmentation.
You can also see the current MTU size on Linux by using the following commands on terminal.
ifconfig
ip a
ip link show
You can also set a new MTU size on Linux by typing command.
sudo ifconfig interface_name mtu size up
For example, if you want to set a packet size of 1500 bytes on eth0:
sudo ifconfig eth0 mtu 1500 up
On ESXI:
Open a terminal and type the following command. X here represents which VMKernel adapter you want to test on.
vmkping -I vmkX -s 8972 -d destination_ip
You can also see the current MTU size on ESXI by typing on terminal.
esxcfg-nics -l
esxcfg-vmknic -l
Result
Testing and configuring the MTU size is critical for ensuring optimal network performance, especially in complex environments where different network segments might have varying capabilities. Using tools like ping, Wireshark, and built-in network commands on your operating system or router, you can diagnose and resolve MTU-related issues to keep your network running efficiently.
Thank you for reading, and I hope this guide helps you with your troubleshooting process. If you have any questions or similar issues, feel free to leave a comment.
Wishing you a successful day!
Best regards,
Hasan