测试 (1472 + 8(ICMP回显示请求和回显应答报文格式长度) + 20(IP首部) = 1500)
$ ping -c 2 -M do -s 1472 192.168.0.6输出
复制代码代码如下:
PING 192.168.0.6 (192.168.0.6) 1472(1500) bytes of data.
bytes from 192.168.0.6: icmp_seq=1 ttl=127 time=1.06 ms
bytes from 192.168.0.6: icmp_seq=2 ttl=127 time=1.06 ms
--- 192.168.0.6 ping statistics ---
packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 1.060/1.062/1.064/0.002 ms
查看本机的mtu
$ netstat -i输出
Kernel Interface table
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0 1500 0 82879 0 0 0 69000 0 0 0 BMRU
lo 16436 0 84 0 0 0 84 0 0 0 LRU
设置
# 设置本机的mtu
sudo ifconfig eth0 mtu 1472
# 查看设置后的结果
$ netstat -i