How to change MTU setting permanently
the MTU in your enviroment is being set automatically via the DHCP, in your configuration you have this setting:
DEVICE=eth0
BOOTPROTO=dhcp
So the DHCP is actually setting the MTU size. In Ubuntu, you can edit the following file: /etc/dhcp/dhclient.conf
Just BEFORE the request line set this two commands:
default interface-mtu 1500;
supercede interface-mtu 1500;
I don't know how to set it in Red Hat, but I think the file is called dhcpd.conf
Hope this helps!
Related videos on Youtube
Vor
Updated on November 19, 2020Comments
-
Vor over 3 years
I need to permanently change
MTU
to1500
. By permanently I mean if I reboot the system or will doservice network restart
it will alway be1500
.I followed this article http://www.cyberciti.biz/faq/centos-rhel-redhat-fedora-debian-linux-mtu-size/
But unfortunately it doens't work for me.
Here is what I did:
check current
MTU
:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP qlen 1000
Added
MTU="1500"
to/etc/sysconfig/network-scripts/ifcfg-eth0
:[root@ip-xx-xx-xxx~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=dhcp ONBOOT=yes TYPE=Ethernet USERCTL=yes PEERDNS=yes IPV6INIT=no PERSISTENT_DHCLIENT=yes IPV6_MTU="1500" MTU="1500"
Then check
MTU
again, ( no luck ):root@ip-xx-xx-xxx ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining IP information for eth0... done. [ OK ] [root@ip-xx-xx-xxx ~]# ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP qlen 1000
/sbin/ifconfig
changedMTU
but only temporally[root@ip-xx-xx-xxx ~]# /sbin/ifconfig eth0 mtu 1500 up [root@ip-xx-xx-xxx ~]# ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
If i restart
network
it is 9001 again:[root@ip-xx-xx-xxx ~]# service network restart Shutting down interface eth0: [ OK ] Shutting down loopback interface: [ OK ] Bringing up loopback interface: [ OK ] Bringing up interface eth0: Determining IP information for eth0... done. [ OK ] [root@ip-10-0-1-135 ~]# ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP qlen 1000