Setting the network MTU size

Though in general it is not necessary there are (rare) occasions when it is necessary to set the MTU size explicitly, generally caused by issues with path MTU discovery.

In general you want to avoid this as using a smaller MTU size that necessary as the overheads associated with each network packet will reduce network throughput.


To explicitly set the MTU size in RedHat or CentOS you need to edit the appropriate network configuration file to add an entry for the MTU size, you don’t need to change anything else. The name of the configuration file depends on the name of the network interface so for eth0 the filename is ifcfg-eth0.

# nano /etc/sysconfig/network-scripts/ifcfg-eth0


For this change to take effect you need to reboot or stop and restart the network.

# reboot


# ifdown eth0
# ifup eth0

Obviously if you are using ssh you will get disconnected when you stop the network!


How you achieve the same thing on a Debian based distributions depends on whether or not you are using DHCP

If you have a static address you can specify the MTU size along with the network address and subnet in /etc/network/interfaces, but this won’t work if you are using DHCP as Debian assumes that the MTU size will be supplied by the DHCP server when the client requests a DHCP lease.

# nano /etc/network/interfaces

auto eth0
iface eth0 inet static

You can workaround this problem by specifying a command that should be run automatically after the interface comes up at the end of that interface section.

# nano /etc/network/interfaces

iface eth0 inet dhcp
    post-up /sbin/ifconfig eth0 mtu 1500

Then you need to either reboot or stop and restart the network.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.