Linux MTU Change Size

by Vivek Gite · 8 comments

We've gigabit networks, and large maximum transmission units (MTU) sizes (JumboFrames) can provide better network performance for our HPC environment. How do I change MTU size under Linux?

You need support in both network hardware and card in order to use JumboFrames. If you want to transfer large amounts of data at gigabit speeds, increasing the default MTU size can provide significant performance gains.

Changing the MTU size with ifconfig command

In order to change the MTU size, use /sbin/ifconfig command as follows:

ifconfig ${Interface} mtu ${SIZE} up
ifconfig eth1 mtu 9000 up

Note this will only work if supported by both the network nterface card and the network components such as switch.

Changing the MTU size permanently under CentOS / RHEL / Fedora Linux

Edit /etc/sysconfig/network-scripts/ifcfg-eth0, enter
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Add MTU, settings:
MTU="9000"
Save and close the file. Restart networking:
# service network restart
Note for IPV6 set dedicated MTU as follows:
IPV6_MTU="1280"

Changing the MTU size permanently under Debian / Ubuntu Linux

Edit /etc/network/interfaces, enter:
# vi /etc/network/interfaces
Add mtu as follows for required interface:
mtu 9000
Save and close the file. Restart the networking, enter:
# /etc/init.d/networking restart

Changing the MTU size permanently (other Linux distros)

Edit /etc/rc.local and add the following line:

/sbin/ifconfig eth1 mtu 9000 up

Updated for accuracy!

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 8 comments… read them below or add one }

1 Yevgen 10.22.09 at 9:51 am

You can use alse another command:
ip link set eth0 mtu 9000
ip link set eth0 up

2 Solaris 10.22.09 at 12:16 pm

Or like this

/etc/network/interfaces

iface eth0 inet static
address 192.168.1.2
network 192.168.1.0
gateway 192.168.1.1
netmask 255.255.255.0
mtu 9000

3 marc 10.22.09 at 3:15 pm

Hello, the “printable version” link adds an extra / slash to the url and then gives a 404. I think it happends on many other pages.

Great job on this site, i follow it by mail and i also use the forum, it’s one of my reference sites. nice job.

4 Vivek Gite 10.22.09 at 4:22 pm

Thanks for the heads up! I’ve fixed the problem. Earlier, today I patched up WP and something did went wrong with my functions file. Let me know if you’ve any more problem.

5 Aaron Toponce 10.22.09 at 4:30 pm

The /etc/rc.local file is severely deprecated, and shouldn’t be used at all. If you want to set MTU sizes on your NIC, then you should be editing the NIC’s config file, not init’s.

For RHEL/Fedora add “MTU=9000″ to /etc/sysconfig/network/ifcfg-eth0
For Debian/Ubuntu add “mtu 9000″ to /etc/network/interfaces

Take the interface down, then back up, and the setting should be applied. This gets a bit more troublesome on NICs that are bound together or for TAP/Bridge devices, but the concept is the same: edit the appropriate NIC config to make the setting.

6 Vivek Gite 10.22.09 at 4:57 pm

@ Solaris/ Aaron,

The faq has been updated.

Appreciate your posts!

7 Nate 10.29.09 at 3:40 am

I tied using MTU 9000 under using Debian under /etc/network/ interfaces with a DHCP applied address and the mtu seems to be taken from the DHCP settings which seems logical, but is a little frustrating.

8 Curiuos 10.29.09 at 3:02 pm

Should this only be enable on interfaces that have local traffic only? What happens to the packets if they are routed to devices that do not support an MTU of that size?

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All