How to test and change MTU on internet\wan interfaces port.
This article is how to test and adjust the internet port for better performance. Let’s say if your Service provider uses an MTU of 1492 and your default WAN interface is set to the standard of 1500 MTU size, your packets will be fragmented (or changed to smaller size packet as they are transmitted out your router).
What is MTU: Maximum Transmission Units, the default is 1500-byte packets for most interface or WAN ports. Let us say I want to download a file and it is 1 meg. The packets are divided into sizes of 1500, but the Service provider only supports 1492, the 1500 packet will be divided into multiple packets which is inefficient. As per RFC 791 the valid range of MTU is 68 to 65535.
How to test if your packets are being fragmented:
Open a command prompt on your computer and type the following command.
ping -f -l 1378 google.com
Pinging google.com [172.217.4.238] with 1492 bytes of data:
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Ping statistics for 172.217.4.238:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Next reduce the buffer size (MTU size) until you get consistent replies (see below). The above command forces the ping to not allow the packet to be fragmented (DF). For example, SonicWALL needs to be adjusted in 8 bytes increments; other firewalls may be different.
ping -f -l 1378 google.com
Pinging google.com [172.217.4.238] with 1378 bytes of data:
Reply from 172.217.4.238: bytes=68 (sent 1378) time=12ms TTL=54
Reply from 172.217.4.238: bytes=68 (sent 1378) time=11ms TTL=54
Reply from 172.217.4.238: bytes=68 (sent 1378) time=10ms TTL=54
Reply from 172.217.4.238: bytes=68 (sent 1378) time=14ms TTL=54
Ping statistics for 172.217.4.238:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round-trip times in milli-seconds:
Minimum = 10ms, Maximum = 14ms, Average = 11ms
*In the ping command the -f means do not fragment, and the -l means is the size of the payload.
How to adjust the MTU on a router\firewall:
Log into your device and go to the interface configuration settings and simple change the MTU size to the new value. In this example it was 1378.
If you are looking to get the best internet speed possible, then, you may want to verify that your router\firewall is set to work with your internet providers MTU size. The above is a fairly easy way to test and modify your Wan port, and to provide a better way to improve the efficiency with your internet providers connection.
References:
Internet connection performance tuning by and MTU tuning for Packet Fragmentation. (PF) RFC 781