What is MTU? How do I find the optimal MTU size for my home network?

Information in computer networks is transmitted in the form of small formed data blocks (in other words, packets). Each packet, in addition to the information being sent, also contains service data that makes up the so-called packet header. This overhead is needed to determine the integrity of the data, the version of network protocols used, etc. In this case, the size of the useful data block is limited to a certain number of bytes. This is done in order to reduce the likelihood of information loss and reduce the time it takes to re-send a packet in case of connection problems.


MTU - what is it?

MTU (from the English Maximum transmission unit) is the maximum amount of data transmitted over the network without further fragmentation (in one packet). Any information that exceeds the MTU is automatically split into small blocks of data before being sent over the network. Possible MTU values ​​depend on the type of network connection you are using. So, when using PPoE (mainly with ADSL and similar technologies), the maximum value of the MTU parameter is 1492 bytes (standard 1500 bytes for Ethernet minus eight bytes of headers), and when using Wi-Fi, MTU can reach 2304 bytes.



In modern operating systems, the optimal MTU value is often calculated by the system itself or taken from the router settings (usually the MTU value is set in the WAN section of the device's network settings). If there are no problems with Internet access, it is better not to change the MTU value. However, if you are experiencing connectivity issues and you suspect that they may be due to fragmented network packets, try changing the MTU value.


This can be done not only by changing the corresponding settings of the router, but also by means of the operating system. Before changing MTU, it is necessary to calculate the optimal value of this parameter. Here's how it's done.


Calculate MTU

You can find the optimal MTU value using the good old ping command. Let's assume that we define the value of this parameter for a wired connection. Open the Windows command line and write the following command:


On Linux, the command usually looks like ping -M do -s 1472 www.google.com, and on macOS ping -D -s 1472 www.google.com (on some versions of systems, the keys may differ, we recommend that you refer to man ping if the command does not work). In this case, we send packets of 1472 bytes to www.google.com and prohibit data fragmentation. If packets of this size cannot be sent, the command will report that packet fragmentation is required. Re-run this command several times, gradually reducing the packet size by 8-10 bytes. As a result, after several attempts, you will find the size value at which the data will be sent. Remember, if you are using a wireless connection, the packet size can be more than 1500 bytes.


Remember the resulting value and add 28 bytes to it (the length of the service headers). The resulting value is the optimal (or close to optimal) MTU for your network.


Set MTU value

Now you know what MTU value you can use on your home network. We will tell the operating system that it is necessary to use it (further examples illustrate the configuration of the IPv4 network).


In Windows, open a command prompt with administrator rights and run the command.The screen will display a list of all network connections, their names and the current MTU size. We remember the name of the connection we need and write the following command:


Here Ethernet is the name of the interface (it may be different), 1450 is the selected MTU size. If the name consists of several words, it must be indicated in quotation marks.


You can enable automatic MTU detection using the same command with the autotuninglevel = normal parameter.If you need to reset the settings to their original state, run the command.On Linux, MTU is configured using the ip command. Let's see the current MTU value:


Here eth0 is the name of the interface, it may be different on your computer. In order for the selected MTU value to be used constantly every time you log on to the system, you need to register the value in the / etc / network / interfaces file, or create a module for systemd. We recommend that you refer to the documentation of the distribution kit you are using for more information.


On macOS, you can see the MTU size for the en0 connection, and then set the parameter value in the terminal:


You can also specify the MTU size in the router settings. In many models of routers, the corresponding setting is in the WAN section. More information can be found on the websites of network equipment manufacturers.


When manually configuring MTU, keep in mind that it is not recommended to set the data block size too small, so as not to create additional load on the router processor. Again, if your network connection is working properly, you shouldn't change the MTU value. The parameters set by the provider or manufacturer of the router are quite suitable for the vast majority of users.

No comments