Linux MTU Change Size

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:
Save and close the file. Restart networking:
# service network restart
Note for IPV6 set dedicated MTU as follows:

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!

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 17 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
17 comments… add one
  • Yevgen Oct 22, 2009 @ 9:51

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

  • Solaris Oct 22, 2009 @ 12:16

    Or like this


    iface eth0 inet static
    mtu 9000

  • marc Oct 22, 2009 @ 15:15

    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.

    • 🐧 nixCraft Oct 22, 2009 @ 16:22

      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.

  • Aaron Toponce Oct 22, 2009 @ 16:30

    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.

  • 🐧 nixCraft Oct 22, 2009 @ 16:57

    @ Solaris/ Aaron,

    The faq has been updated.

    Appreciate your posts!

  • Nate Oct 29, 2009 @ 3:40

    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.

  • Curiuos Oct 29, 2009 @ 15:02

    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?

  • davinder Singh May 10, 2010 @ 16:06

    I have tried the same but it is not working & giving the following error

    [root@server home]# /etc/init.d/network restart
    Shutting down interface eth0: [ OK ]
    Shutting down loopback interface: [ OK ]
    Bringing up loopback interface: [ OK ]
    Bringing up interface eth0: SIOCSIFMTU: Invalid argument

    • Anonymous May 10, 2010 @ 20:12

      and what did you change?

      • davinder Singh May 11, 2010 @ 16:03

        I have givren the below.

        • Anonymous May 12, 2010 @ 5:32

          i think here is the driver limitation…
          i have similar situation
          root@bigboy:~# ifconfig eth0 mtu 1490
          root@bigboy:~# ifconfig eth0 mtu 1501
          SIOCSIFMTU: Invalid argument

    • Riot77 Jun 19, 2016 @ 16:26

      It happened to me (in our company cluster) that the issue was with the mode that interface was in. It was in the datagram instead in the connected. With “# echo connected >> echo connected > /sys/class/net/ethX/mode” you can change the mode, and that enables you to also change the MTU.

      Hope it helps. -R

  • Markus Torstensson Jun 23, 2011 @ 10:46

    “SIOCSIFMTU: Invalid argument” is the drivers way to tell you that the hardware doesn’t support that framesize. Try increment iteratively til reaching the roof.

    Does your switch support this MTU?

    Remember that both sides needs to support this MTU or else fragmentation will occur!

    Try your setting out by pinging with a specific MTU:

    ping -s [MTU-28] -M do [ip-address]

    Remember to substract 28 from the set MTU giving space for headers. If packets are dropped or messages about fragmentation is recieved, lower MTU size further.

    Have a look at these pages too:
    Linux Configure Jumbo Frames to Boost Network Performance / Throughput

  • hduiya May 1, 2016 @ 14:41

    my linux does’nt haveinternet accses in dual-boot system

  • hduiya May 1, 2016 @ 14:42

    need any help plsssssssssssssssssss

  • jansi Dec 4, 2017 @ 12:51

    please help me any one how to change MTU size in Linux pc .we able to set MTU as 9000 but it is not reflecting ……

    /sbin/ifconfig eth0 mtu 9000 up …. i trying use this command , i able to see the “invalid argument” error

    /sbin/ifconfig eth0 mtu 4000 up ….till 4000 i able to change the value and ifconfig also getting changed …..

    what could be the issue please any help for this issue ….?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum