Setting Your Maximum Transmission Unit (MTU)
What is MTU?
The maximum transmission unit (MTU) is the largest size packet or frame that can be sent over a network.
Why Set the MTU?
Every packet you send has a body and a header. The header contains overhead information necessary for packets to be sent over the network, such as where to send the packet to and where it came from. Since there needs to be header information on every packet and the amount of information necessary shouldn't really change if we increase the MTU, more information will be sent in the body when the MTU is increased, thus reducing the number of packets that need to be sent to fulfill a task, such as transfer a file. Sending less packets means that reduces the amount of network bandwidth that is "wasted" by header information, and reduces the processing load on the network devices handling the sheer number of packets. Increasing the MTU is particularly useful for when you are sending large amounts of data over a network, such as for large file transfers.
However, these gains are only realized if each link in the network path is configured to enable jumbo frames at the same MTU. Otherwise, performance may decrease as incompatible devices drop frames or fragment them which can increase the CPU load.
For most networks, (such as the internet), an MTU size of 1500 is appropriate. However, if you have a fileserver connected to other hosts on a dedicated LAN, you may wish to configure that LAN to use Jumbo frames which can be as large as 9,000 bytes (just set the MTU to 9000).
How Do I set MTU Size?
In most cases, you shouldn't really need to manually configure the MTU as it will usually be automatically be negotiated/discovered. However, if you wish to set it, on an Ubuntu/Debian server, you would simply edit your
/etc/network/interfaces file and add the
mtu line as shown below in my NAS's config. Then you would need to restart the network.
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto p4p1 iface p4p1 inet static address 10.1.0.4 netmask 255.248.0.0 gateway 10.0.0.1 dns-nameservers 10.1.0.2 auto p2p1 iface p2p1 inet static address 192.168.1.2 netmask 255.255.255.0 #gateway 192.168.1.2 dns-nameservers 10.1.0.2 mtu 9000
As you can see, I have set the MTU to 9000 for Jumbo frames on the dedicated network for transferring files, but I don't set it on internet connection.
For Ubuntu Desktop users, you would open up the network manager, select the connection to edit and click the Edit button:
Then you need to click the Ethernet tab and set the MTU value before saving and reconnecting on the link.
Check My MTU
The output of
ifconfig should show you your MTU for your various network interfaces as shown below:
I found the easiest way to check that my MTU was working was to use
tracepath like so:
tracepath [server IP]
You should see this (my internal LAN using jumbo frames):
- TechTarget - maximum transmission unit (MTU)
- Unix & Linux - Discover MTU between me and destination IP
- Nixcraft - Linux Configure Jumbo Frames to Boost Network Performance / Throughput
- Wikipedia - Maximum transmission unit
First published: 16th August 2018