Networking

為什麼 MTU 的大小是 96?

  • February 6, 2022

所以在發現我可以通過調整 MTU 來提高網際網路速度之後,我的 MTU 似乎只有 96 字節。知道為什麼嗎?

ping -c 3 -M do -s 68 google.com
PING google.com (172.217.169.46) 68(96) bytes of data.
76 bytes from lhr48s08-in-f14.1e100.net (172.217.169.46): icmp_seq=1 ttl=119 time=20.2 ms
76 bytes from lhr48s08-in-f14.1e100.net (172.217.169.46): icmp_seq=2 ttl=119 time=21.7 ms
76 bytes from lhr48s08-in-f14.1e100.net (172.217.169.46): icmp_seq=3 ttl=119 time=19.7 ms

--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 19.742/20.546/21.664/0.815 ms

讓我們增加一個字節:

ping -c 3 -M do -s 69 google.com
PING google.com (172.217.169.46) 69(97) bytes of data.

--- google.com ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2002ms

在 Ubuntu 20.04.3 LTS 上執行

根據@Halfgaar 的評論,Google正在阻止大型 ICMP 數據包。所以讓我們試試別的東西:

ping -c 3 -M do -s 1464 bbc.co.uk
PING bbc.co.uk (151.101.0.81) 1464(1492) bytes of data.
1472 bytes from 151.101.0.81 (151.101.0.81): icmp_seq=1 ttl=60 time=20.0 ms
1472 bytes from 151.101.0.81 (151.101.0.81): icmp_seq=2 ttl=60 time=20.2 ms
1472 bytes from 151.101.0.81 (151.101.0.81): icmp_seq=3 ttl=60 time=20.5 ms

--- bbc.co.uk ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 20.007/20.214/20.478/0.196 ms

引用自:https://serverfault.com/questions/1092679