修改 Linux 网卡的 MTU

发布时间: 更新时间: 总字数:473 阅读时间:1m 作者: IP属地: 分享 复制网址

最大传输单元(Maximum Transmission Unit,MTU)是指一种通信协议的某一层上面所能通过的最大数据包大小(以字节为单位),在使用 Linux 时,如果 MTU 不匹配,会导致网卡无法接受数据,本文介绍如何修改网卡 MTU 的方法。

什么是MTU

The maximum transmission unit (MTU) of a communications protocol of a layer is the size (in bytes) of the largest protocol data unit that the layer can pass onwards.

如何修改其大小

使用ifconfig来修改

ifconfig ${INTERFACE_NAME} mtu ${SIZE} up
  • INTERFACE_NAME是要配置的网卡的名字,例如eth0
  • SIZE 是MTU的大小,例如1600

For example:

ifconfig eth0 mtu 1600 up

对于CentOS/RHEL/Fedora Linux,可以通过修改/etc/sysconfig/network-scripts/ifcfg-*来修改:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
MTU=1600

重启网络服务

service network restart

对于Debian/Ubuntu Linux,可以通过修改 /etc/network/interfaces来修改,编辑/etc/network/interfaces:

vi /etc/network/interfaces
mtu 1600

重启网络

# /etc/init.d/networking restart

对于其他Linux系统,可以通过修改 /etc/rc.local, 在其中追加一下配置:

/sbin/ifconfig ${INTERFACE_NAME} mtu ${SIZE} up
  • INTERFACE_NAME是要配置的网卡的名字,例如eth0
  • SIZE 是MTU的大小,例如1600

Maximum transmission unit

Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数