How to determine the optimal MTU and MSS size


#1

Setting the correct MTU size can make a difference in optimizing your network speeds.

The MTU size, or Maximum Transmission Unit Size, is the largest physical packet size, measured in bytes, that a network can transmit.
Any messages larger than the MTU are divided into smaller packets before being sent.

The default setting of the MTU size on Peplink routers is 1440 to accommodate for the different quality of ISP connections from around the world.

The best value for MTU is that value just before your packets get fragmented.
You can determine the optimal MTU size by using PING at a command prompt.

Open a command prompt and type (start by using a value of 1472 which is equivalent to MTU size 1500):

Ping www.peplink.com -f -l 1472
Press Enter.

If you see the message "Packet needs to be fragmented but DF set.” , you need to lower the packet size.

Then try a lower packet size (for example 1412) until you get a successful ping response instead of the "Packet needs to be fragmented but DF set.” message.
Keep changing the packet size until you have found the highest packet size that can be sent in your network without being fragmented.

Add 28 more to this (since you specified ping packet size, not including the IP/ICMP header of 28 bytes) And this is your Maximum MTU.

In my case the maximum packet size is 1412 + 28 = 1440.

In the web interface of your Peplink router open the WAN connection details to adjust your MTU size.
If your optimum MTU size is not 1440, select Custom Value and type in your optimum MTU size.

If you would like to do the same in OS X use the following command instead in a text editor:
ping -D -s 1472 www.peplink.com

Additionally, there is a field to specify the MSS size, or Maximum Segment Size of the WAN connection.
This value will be announced to remote TCP servers for maximum data that it can receive during the establishment of TCP connections.
When Auto is selected, MSS is dependent on the MTU value.
Some Internet servers are unable to listen to MTU setting if ICMP is filtered by firewall between the connections, in which case it could be necessary to configure the MSS settings.

image

The maximum segment size (MSS) is a parameter of the options field of the TCP header that specifies the largest amount of data, specified in bytes, that a computer or communications device can receive in a single TCP segment. It does not count the TCP header or the IP header (unlike, for example, the MTU for IP datagrams).

Normally, MSS is equal to MTU minus 40.
You are recommended to reduce the MSS only if changing the MTU value cannot effectively inform some remote servers to size down data size.