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
Output:
eth0 Link encap:Ethernet HWaddr 00:0F:EA:91:04:07 inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20f:eaff:fe91:407/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 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
Output:
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 0.0.0.0 brd 0.0.0.0
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
OR
# ip link set dev eth0 mtu 1400
Verify that new mtu is setup with following command:
$ ip link list
OR
$ /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
address 192.168.1.2
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
gateway 192.168.1.254
mtu 1400
post-up /etc/fw.start
post-down /etc/fw.stop
/etc/sysconfig/network-scripts/ifcfg-eth0 (Red Hat Linux )
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=00:0F:EA:91:04:07
IPADDR=192.168.1.111
NETMASK=255.255.255.0
NETWORK=192.168.1.0
MTU=1400
ONBOOT=yes
TYPE=Ethernet
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
- Share on Twitter • Facebook • 4 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
You did not say which setting for the MTU is better whether to increase this number to decrease the number. Which is better ?????????
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…
Thanks a lot!
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?