Geek Projects – Linux, Apache, MySQL, PHP, DNS A Linux Sysadmin

July 29, 2015

Increase CentOS 7’s MTU

Filed under: Linux — Matt @ 10:09 pm

Ethernet interfaces normally use an MTU of 1500 bytes.

I recently needed to increase the MTU use by the NICs on a point-to-point link to 9000 bytes in order to improve DRBD performance. This is sometimes referred to as enabling jumbo frames.

In the past I’ve used ifconfig to test this change out. For example, to increase the MTU of the eth0 interface from the default of 1500 bytes to 9000 bytes, I would run

ifconfig eth0 mtu 9000

I could then verify that the new MTU had been applied by running:

ifconfig eth0

Unfortunately for me the two servers that I was working on, like many CentOS 7 systems did not have the ifconfig command installed.

If you want the ifconfig command, then you can install it by installing the net-tools package:

yum install net-tools

However, I wanted to avoid making any changes other than increasing the MTU, so I use the ip command instead.

The ip command can be used in place of ifconfig for many purposes, including increasing the MTU. For example, to increase the MTU of the eth0 interface from the default of 1500 bytes to 9000 bytes, run:

ip link set mtu 9000 dev eth0

You can then verify that the new MTU has taken effect by running:

ip link show dev eth0

After you’ve applied the new MTU, and verified that all is working as expected, be sure to update the interface’s configuration file, so that this change persists the next time the server is rebooted.

To edit the MTU for the eth0 interface, add an “MTU=” line to the /etc/sysconfig/network-scripts/ifcfg-eth0 file. For example:

MTU=9000

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress