Linux测试path mtu

ping   -c 2  -M do  -4    -s  1472      192.168.1.1
PING 192.168.1.1 (192.168.1.1) 1472(1500) bytes of data.
1480 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.680 ms
1480 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=1.15 ms

因为加上icmp的header长度为28, payload最多只能为1472, 因为ethernet的mtu是1500

ping -c 2 -M do -4 -s 1372 114.114.114.114
ping -c 2 -M do -4 -s 1372 218.104.111.122 (联通)

IPv6

ping   -c 2  -M do  -6    -s  1384      2408:8888::8
ping   -c 2  -M do  -6    -s  1384      www.qq.com

IPv4 header (20 bytes)
IPv6 header (40 bytes)

实际测试, IPV6路由设备比较新, 反而可以带更多数据

在阿里云上 连接 he.net

ping   -c 2  -M do  -4    -s  1472      he.net

ethernet 14
ipv4 20
ip 1480-1464 = 16
payload 1464

无线数据网络 4G LTE/5G NR MTU居然只有 1400

Some US based cellular networks require a lower than default MTU to be used on our router’s PPP interface.
If the MTU is left as the default value, the result will be that packets larger than the network maximum will be discarded. This shows up as web pages not displaying in the web browser when using our cellular router as a gateway to the internet.

Recommended values are:
AT&T 1420 bytes
Verizon 1428 bytes
Others 1430 bytes
(PPP interface default is 1500 bytes)

To ensure our routers work well on all carriers. set the PPP interface local and remote MRU to 1420.

Via CLI (telnet / SSH / ‘Execute a command’ in the GUI):
ppp 1 l_mru 1400
ppp 1 r_mru 1400
config 0 save
ppp 1 deact_rq

在VPS上测试google

 
ping   -c 2  -M do  -6    -s  1452      www.google.com
ping   -c 2  -M do  -4    -s  1472      www.google.com

恰好说明IPV6 头部 比 IPV4大20字节

电信 5G 对 电信5G, 也是 1452

ping -c 2 -M do -6 -s 1432 国外
ping -c 2 -M do -6 -s 1452 240e:d:1000:100::6

少的这20个字节,是 tb 😃

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注