Reputation: 35149
I need to permanently change MTU
to 1500
. By permanently I mean if I reboot the system or if I do service network restart
it should always be 1500
.
I followed this article http://www.cyberciti.biz/faq/centos-rhel-redhat-fedora-debian-linux-mtu-size/
But unfortunately it doesn'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
changed MTU
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
Upvotes: 6
Views: 37923
Reputation: 191
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;
supersede 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!
Upvotes: 14
Reputation: 1
If dhclient.conf doesn't exist in your OS, all settings about dhclient.conf wouldn't work. Please refer to: https://github.com/linux-enhancement/set_mtu.
The set_mtu script aims to set mtu easily.
$ bash set_mtu.sh set eth0 1600
Interface eth0 exists.
MTU 1600 is a number.
[1/2] Start to set MTU of eth0 to 1600 temporarily -- Done.
Set MTU of eth0 to 1600 temporarily Successfully.
[2/2] Start to set MTU of eth0 to 1600 permanently.
[2.1] Setting MTU of eth0 to 1600 permanently in DHCP -- Done.
Set MTU of eth0 in DHCP to 1600 permanently Successfully.
[2.2] Setting MTU of eth0 to 1600 permanently in config file -- Done.
Set MTU of eth0 in config file to 1600 permanently Successfully.
Upvotes: 0