我需要将MTU
永久更改为1500
。永久性地,我的意思是,如果我重启系统或将service network restart
,它将始终是1500
。
我遵循了这篇文章http://www.cyberciti.biz/faq/centos-rhel-redhat-fedora-debian-linux-mtu-size/
但不幸的是,它对我有用。
这是我做的:
检查当前MTU
:
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP qlen 1000
将MTU="1500"
添加到/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"
然后再次检查MTU
,(没有运气):
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
已更改MTU
,但仅限于暂时
[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
如果我重新启动network
,它又是9001:
[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
答案 0 :(得分:12)
您的环境中的MTU是通过DHCP自动设置的,在您的配置中您有此设置:
DEVICE=eth0
BOOTPROTO=dhcp
所以DHCP实际上是设置MTU大小。在Ubuntu中,您可以编辑以下文件:/etc/dhcp/dhclient.conf
在请求行之前设置这两个命令:
default interface-mtu 1500;
supercede interface-mtu 1500;
我不知道如何在Red Hat中设置它,但我认为该文件名为dhcpd.conf
希望这有帮助!