Persistently change the MTU of an network interface (Red Hat)
Content |
Specific to |
Red Hat-based distributions |
Tested on |
CentOS (5.5) |
Fedora (14) |
Objective
To persistently change the MTU of a network interface on a Red Hat-based system
Background and Scenario
See Change the MTU of a network interface.
Method
Edit the configuration script for the relevant interface in /etc/sysconfig/network-scripts/
. If named directly after the interface eth0
then this would be called ifcfg-eth0
, however other names are possible (including ifcfg-Auto_eth0
if using the Gnome Network Manager). If no configuration script exists then you will need to create one.
Add a line to specify the MTU, for example:
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.2
NETMASK=255.255.255.0
MTU=9000
Unlike the corresponding method for Debian-based systems, it is possible to set the MTU of interfaces that use DHCP:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=02:00:00:00:00:00
ONBOOT=yes
MTU=9000
It is permissible for the values given in this file to be single- or double-quoted.
The new MTU can be activated by taking the interface down using ifdown
then bringing it back up using ifup
:
ifdown eth0 ifup eth0
Alternatively you could reboot the machine.
Testing
See Change the MTU of a network interface.
Errors
SIOCSIFMTU: Invalid argument
See Change the MTU of a network interface.
Invalid mtu value
An error of the form:
Error: argument "x" is wrong: invalid "mtu" value
indicates that the specified MTU could not be interpreted as an integer.
Alternatives
The following configuration programs have the ability to change the MTU of a network interface:
Distribution | Command | Menu item |
---|---|---|
Centos 5.5 | system-config-network | System ⇒ Administration ⇒ Network |
Fedora 14 | nm-connection-editor | System ⇒ Preferences ⇒ Network Connections |
OpenSUSE 11.3 | yast2 | Computer ⇒ YaST |
These interoperate with the configuration script described above, so it should be possible to switch between manual and assisted configuration with caution.
Tags: mtu