How can I setup the MTU for my network interface?

MTU (Maximum Transmission Unit) is related to TCP/IP networking in Linux/BSD/UNIX oses. It refers to the size (in bytes) of the largest datagram that a given layer of a communications protocol can pass at a time.

You can see current MTU setting with ifconfig command under Linux:

# /sbin/ifconfig


eth0      Link encap:Ethernet  HWaddr 00:0F:EA:91:04:07
         inet addr:  Bcast:  Mask:
         inet6 addr: fe80::20f:eaff:fe91:407/64 Scope:Link
         RX packets:141567 errors:0 dropped:0 overruns:0 frame:0
         TX packets:141306 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:101087512 (96.4 MiB)  TX bytes:32695783 (31.1 MiB)
         Interrupt:18 Base address:0xc000

A better way is to use ip command:

$ ip link list


1: lo:  mtu 16436 qdisc noqueue
   link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0:  mtu 1500 qdisc pfifo_fast qlen 1000
   link/ether 00:0f:ea:91:04:07 brd ff:ff:ff:ff:ff:ff
3: sit0:  mtu 1480 qdisc noop
   link/sit brd

As you see, MTU set to 1500 for eth0. Let us say you want this to 1400 then you can use any one of the following command to setup MTU:

# ifconfig eth0 mtu 1400


# ip link set dev eth0 mtu 1400

Verify that new mtu is setup with following command:

$ ip link list


$ /sbin/ifconfig

To make the setting permanent for eth0, edit the configuration file:
/etc/network/interfaces (Debian Linux file)

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
name Ethernet LAN card
mtu 1400
post-up /etc/fw.start
post-down /etc/fw.stop

/etc/sysconfig/network-scripts/ifcfg-eth0 (Red Hat Linux )


Save the file and restart network service

If you are using Redhat:

# service network restart

If you are using Debian:

# /etc/init.d/networking restart

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

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir 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
4 comments… add one
  • Rickey Ross Jan 1, 2009 @ 0:46

    You did not say which setting for the MTU is better whether to increase this number to decrease the number. Which is better ?????????

  • Bala May 22, 2015 @ 6:53

    If we configured the MTU 1500 in my router WAN port and media provider setting MTU is 9000 in towards router link means, what will happens…. whether it is Ok or not…if if not means wht is a solution…

  • Brody Nov 11, 2015 @ 13:06

    Thanks a lot!

  • sugandha Mar 1, 2016 @ 6:53

    in one of the linux systems i observer that MTU value for all interface showss 1500 but for Lo it shows 16436, it is something not set in the netwrk scrift config file also, Then how does system interface pick this value?

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