我需要永久性地将MTU更改为1500.永久地我的意思是,如果我重新启动系统或将重新启动服务,它将始终是1500.
我遵循了这篇文章http://www.cyberciti.biz/faq/centos-rhel-redhat-fedora-debian-Linux-mtu-size/
但不幸的是,它对我不起作用.
这是我做的:
检查当前的MTU:
eth0: mtu 9001 qdisc pfifo_fast state UP qlen 1000
将MTU =“1500”添加到/ etc / sysconfig / network-scripts / ifcfg-eth0:
[[email protected]~]# 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,(没有运气):
[email protected] ~]# 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 ]
[[email protected] ~]# ip addr show eth0
2: eth0: mtu 9001 qdisc pfifo_fast state UP qlen 1000
/ sbin / ifconfig改变了MTU但只是暂时的
[[email protected] ~]# /sbin/ifconfig eth0 mtu 1500 up
[[email protected] ~]# ip addr show eth0
2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
如果我重新启动网络,它再次是9001:
[[email protected] ~]# 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 ]
[[email protected] ~]# ip addr show eth0
2: eth0: mtu 9001 qdisc pfifo_fast state UP qlen 1000
您的环境中的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
希望这可以帮助!