SLIGHTNING 的编程日记

神奇的 MTU 异常,导致我打不开 Microsoft 网站

问题

我想打开 Outlook 查看邮件,结果:

1
2
outlook 无法连接到互联网。请检查连接。
重试

然后尝试通过 www.microsoft.com 进入 Outlook,结果发现 microsoft.com 下的网站都打不开,提示无法建立连接或连接超时。

我用的系统是 Linux Mint 22.3,网络是中国移动的宿舍宽带,使用网线通过 USB 拓展坞接到电脑上。

初步排查

先 ping 一下试试:

1
2
3
4
5
6
7
8
9
10
11
12
$ ping www.microsoft.com
PING e13678.*.*.net (23.*.*.38) 56(84) bytes of data.
64 bytes from a23-*-*-38.deploy.static.*.com (23.*.*.38): icmp_seq=1 ttl=45 time=264 ms
64 bytes from a23-*-*-38.deploy.static.*.com (23.*.*.38): icmp_seq=2 ttl=45 time=263 ms
64 bytes from a23-*-*-38.deploy.static.*.com (23.*.*.38): icmp_seq=3 ttl=45 time=264 ms
64 bytes from a23-*-*-38.deploy.static.*.com (23.*.*.38): icmp_seq=4 ttl=45 time=265 ms
64 bytes from a23-*-*-38.deploy.static.*.com (23.*.*.38): icmp_seq=5 ttl=45 time=265 ms
64 bytes from a23-*-*-38.deploy.static.*.com (23.*.*.38): icmp_seq=6 ttl=45 time=264 ms
^C
--- e13678.*.*.net ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5006ms
rtt min/avg/max/mdev = 263.098/264.143/265.337/0.746 ms

ping 可以连通。

再用 curl 访问一下:

1
$ curl www.microsoft.com

curl 的访问结果有时正常,有时报一些奇奇怪怪的错误,如:curl: (92) HTTP/2 stream 1 was not closed cleanly: PROTOCOL_ERROR (err 1)。

而在浏览器中访问就没有成功过,所以 curl 的报错不是重点。

考虑到中国移动可能会屏蔽一些 IP,去 ITDOG 上测试了一下,没有任何节点访问失败。

不过我还是清理 DNS 后试了试,当然没有用了。

接下来,我又尝试了更换浏览器、使用无痕模式、关闭浏览器插件,都没用。

然后,使用手机连接电脑共享的热点,可以正常访问;电脑连手机网络也可以正常访问;将网线连到手机上(拓展坞有 Type-C 接口,能接到手机上),也可以正常访问。

这说明,该网络问题与电脑和该网络有关。所以,我尝试了:删除了网络记录后重新连接;进行系统恢复。虽然一点用都没有。

这个问题真是难搞。

问 AI

实在是搞不定,问了问 AI,得到答复中最可能的原因:

  • 系统代理/PAC 配置,Chrome/Firefox 都跟随,而 curl 不受影响。
  • 浏览器安全DNS/DoH 解析到另一个 Akamai IP,该 IP 在你移动宽带下不通。
  • IPv6 黑洞,浏览器优先 AAAA,curl 默认走 IPv4。
  • HTTP/3 QUIC UDP 443 被丢,浏览器回退慢/超时。
  • 防火墙/安全软件按浏览器进程拦截。
  • MTU/网卡 offload 导致 HTTPS 大包卡住。

从最有可能的原因一个个排查:

系统代理根本没开,排除。

DoH 我用的浏览器默认不开,排除。

IPv6 黑洞可以用 curl 测试:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ curl -6 -v --connect-timeout 10 -o /dev/null https://www.microsoft.com/
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Host www.microsoft.com:443 was resolved.
* IPv6: 2600:1417:8400:284::356e, 2600:1417:8400:28e::356e, 2600:1417:8400:280::356e
* IPv4: (none)
* Trying [2600:1417:8400:284::356e]:443...
* Immediate connect fail for 2600:1417:8400:284::356e: 网络不可达
* Trying [2600:1417:8400:28e::356e]:443...
* Immediate connect fail for 2600:1417:8400:28e::356e: 网络不可达
* Trying [2600:1417:8400:280::356e]:443...
* Immediate connect fail for 2600:1417:8400:280::356e: 网络不可达
* Failed to connect to www.microsoft.com port 443 after 1 ms: Couldn't connect to server
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Closing connection
curl: (7) Failed to connect to www.microsoft.com port 443 after 1 ms: Couldn't connect to server

发现我的电脑根本不支持 IPv6。

然后尝试关闭 HTTP/3:

在 Firefox about:config 中设置 network.http.http3.enable 为 false。

然后用 tcpdump 抓包:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
$ sudo tcpdump -ni any 'tcp port 443 or udp port 443' -c 40
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
16:*:*.861713 enx***e50 Out IP 10.*.*.118.37066 > 146.*.*.91.443: Flags [.], seq 436997547:436998987, ack 2912575519, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.861740 enx***e50 Out IP 10.*.*.118.37046 > 146.*.*.91.443: Flags [.], seq 1955043437:1955044877, ack 2702494772, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.718826 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49454: Flags [P.], seq 470743325:470743349, ack 2709175742, win 83, options [nop,nop,TS val *** ecr ***], length 24
16:*:*.718827 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49454: Flags [F.], seq 24, ack 1, win 83, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.719198 enx***e50 Out IP 10.*.*.118.49454 > 60.*.*.5.443: Flags [P.], seq 1:25, ack 25, win 63, options [nop,nop,TS val *** ecr ***], length 24
16:*:*.719305 enx***e50 Out IP 10.*.*.118.49454 > 60.*.*.5.443: Flags [F.], seq 25, ack 25, win 63, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.742937 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49454: Flags [R], seq 470743350, win 0, length 0
16:*:*.742938 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49454: Flags [R], seq 470743350, win 0, length 0
16:*:*.749176 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49458: Flags [P.], seq 68947700:68947724, ack 590624334, win 83, options [nop,nop,TS val *** ecr ***], length 24
16:*:*.749177 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49458: Flags [F.], seq 24, ack 1, win 83, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.749274 enx***e50 Out IP 10.*.*.118.49458 > 60.*.*.5.443: Flags [.], ack 24, win 63, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.749599 enx***e50 Out IP 10.*.*.118.49458 > 60.*.*.5.443: Flags [P.], seq 1:25, ack 25, win 63, options [nop,nop,TS val *** ecr ***], length 24
16:*:*.749674 enx***e50 Out IP 10.*.*.118.49458 > 60.*.*.5.443: Flags [F.], seq 25, ack 25, win 63, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.774304 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49458: Flags [R], seq 68947725, win 0, length 0
16:*:*.774305 enx***e50 In IP 60.*.*.5.443 > 10.*.*.118.49458: Flags [R], seq 68947725, win 0, length 0
16:*:*.397595 enx***e50 Out IP 10.*.*.118.40366 > 223.*.*.106.443: Flags [.], ack 3394292139, win 89, length 0
16:*:*.410252 enx***e50 In IP 223.*.*.106.443 > 10.*.*.118.40366: Flags [.], ack 1, win 83, length 0
16:*:*.957691 enx***e50 Out IP 10.*.*.118.37058 > 146.*.*.91.443: Flags [.], seq 2918753000:2918754440, ack 1282371361, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.957721 enx***e50 Out IP 10.*.*.118.39890 > 146.*.*.91.443: Flags [.], seq 2811925078:2811926518, ack 812541663, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.469629 enx***e50 Out IP 10.*.*.118.60862 > 20.*.*.171.443: Flags [.], seq 874273844:874275284, ack 381910747, win 78, length 1440
16:*:*.517637 enx***e50 Out IP 10.*.*.118.50736 > 223.*.*.106.443: Flags [.], ack 1665113347, win 99, length 0
16:*:*.523481 enx***e50 In IP 223.*.*.106.443 > 10.*.*.118.50736: Flags [.], ack 1, win 83, length 0
16:*:*.541593 enx***e50 Out IP 10.*.*.118.50734 > 223.*.*.106.443: Flags [.], ack 2579590770, win 80, length 0
16:*:*.546485 enx***e50 In IP 223.*.*.106.443 > 10.*.*.118.50734: Flags [.], ack 1, win 83, length 0
16:*:*.054613 enx***e50 Out IP 10.*.*.118.39150 > 23.*.*.38.443: Flags [.], seq 115983857:115985297, ack 1226200170, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.590616 enx***e50 Out IP 10.*.*.118.48112 > 23.*.*.38.443: Flags [.], seq 1159896193:1159897633, ack 1096888155, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.637599 enx***e50 Out IP 10.*.*.118.40366 > 223.*.*.106.443: Flags [.], ack 1, win 89, length 0
16:*:*.650095 enx***e50 In IP 223.*.*.106.443 > 10.*.*.118.40366: Flags [.], ack 1, win 83, length 0
16:*:*.557436 enx***e50 Out IP 10.*.*.118.55618 > 146.*.*.91.443: Flags [S], seq 3742167216, win 64240, options [mss 1460,sackOK,TS val *** ecr ***,nop,wscale 10], length 0
16:*:*.632333 enx***e50 In IP 146.*.*.91.443 > 10.*.*.118.55618: Flags [S.], seq 1681108537, ack 3742167217, win 65535, options [mss 1452,sackOK,TS val *** ecr ***,nop,wscale 9], length 0
16:*:*.632378 enx***e50 Out IP 10.*.*.118.55618 > 146.*.*.91.443: Flags [.], ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.633014 enx***e50 Out IP 10.*.*.118.55618 > 146.*.*.91.443: Flags [P.], seq 1:1903, ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 1902
16:*:*.706932 enx***e50 In IP 146.*.*.91.443 > 10.*.*.118.55618: Flags [.], ack 1, win 285, options [nop,nop,TS val *** ecr ***,nop,nop,sack 1 {1441:1903}], length 0
16:*:*.728580 enx***e50 Out IP 10.*.*.118.55618 > 146.*.*.91.443: Flags [.], seq 1:1441, ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.826691 enx***e50 Out IP 10.*.*.118.40366 > 223.*.*.106.443: Flags [P.], seq 1:1805, ack 1, win 89, length 1804
16:*:*.839481 enx***e50 In IP 223.*.*.106.443 > 10.*.*.118.40366: Flags [.], ack 1805, win 83, length 0
16:*:*.866437 enx***e50 In IP 223.*.*.106.443 > 10.*.*.118.40366: Flags [P.], seq 1:984, ack 1805, win 83, length 983
16:*:*.866487 enx***e50 Out IP 10.*.*.118.40366 > 223.*.*.106.443: Flags [.], ack 984, win 91, length 0
16:*:*.005676 enx***e50 Out IP 10.*.*.118.55618 > 146.*.*.91.443: Flags [.], seq 1:1441, ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 1440
16:*:*.557665 enx***e50 Out IP 10.*.*.118.55618 > 146.*.*.91.443: Flags [.], seq 1:1441, ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 1440
40 packets captured
40 packets received by filter
0 packets dropped by kernel
$ sudo tcpdump -ni any 'tcp port 443 or udp port 443' -c 40
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
16:*:*.923573 enx***e50 Out IP 10.*.*.118.52442 > 23.*.*.38.443: Flags [S], seq 2635444720, win 64240, options [mss 1460,sackOK,TS val *** ecr ***,nop,wscale 10], length 0
16:*:*.095791 enx***e50 In IP 120.*.*.162.443 > 10.*.*.118.53406: Flags [P.], seq 578364850:578364923, ack 3016652547, win 1038, options [nop,nop,TS val *** ecr ***], length 73
16:*:*.096452 enx***e50 Out IP 10.*.*.118.53406 > 120.*.*.162.443: Flags [F.], seq 1, ack 73, win 62, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.105612 enx***e50 In IP 120.*.*.162.443 > 10.*.*.118.53406: Flags [F.], seq 73, ack 2, win 1038, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.105694 enx***e50 Out IP 10.*.*.118.53406 > 120.*.*.162.443: Flags [.], ack 74, win 62, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.164898 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [S], seq 2224137846, win 64240, options [mss 1460,sackOK,TS val *** ecr ***,nop,wscale 10], length 0
16:*:*.174280 enx***e50 Out IP 10.*.*.118.52456 > 23.*.*.38.443: Flags [S], seq 2599923203, win 64240, options [mss 1460,sackOK,TS val *** ecr ***,nop,wscale 10], length 0
16:*:*.177056 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [S.], seq 954243173, ack 2224137847, win 65535, options [mss 1412,sackOK,TS val *** ecr ***,nop,wscale 8], length 0
16:*:*.177150 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [.], ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.178618 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 1:2535, ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 2534
16:*:*.183312 enx***e50 In IP 23.*.*.38.443 > 10.*.*.118.52442: Flags [S.], seq 1235561609, ack 2635444721, win 65160, options [mss 1452,sackOK,TS val *** ecr ***,nop,wscale 7], length 0
16:*:*.183392 enx***e50 Out IP 10.*.*.118.52442 > 23.*.*.38.443: Flags [.], ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.185306 enx***e50 Out IP 10.*.*.118.52442 > 23.*.*.38.443: Flags [P.], seq 1:1896, ack 1, win 63, options [nop,nop,TS val *** ecr ***], length 1895
16:*:*.188934 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 1401, win 1045, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.188935 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 2535, win 1041, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.234135 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [P.], seq 1:4192, ack 2535, win 1041, options [nop,nop,TS val *** ecr ***], length 4191
16:*:*.234136 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [P.], seq 4192:4440, ack 2535, win 1041, options [nop,nop,TS val *** ecr ***], length *
16:*:*.234275 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [.], ack 4192, win 72, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.234309 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [.], ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.236069 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 2535:2625, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 90
16:*:*.236468 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 2625:2717, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 92
16:*:*.237008 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 2717:3115, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 398
16:*:*.237168 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 3115:5915, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 2800
16:*:*.237199 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 5915:8715, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 2800
16:*:*.237219 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 8715:11515, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 2800
16:*:*.237238 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [.], seq 11515:12915, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 1400
16:*:*.247737 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 2625, win 1041, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.247737 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 2717, win 1041, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.247872 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 12915:13295, ack 4440, win *, options [nop,nop,TS val *** ecr ***], length 380
16:*:*.248028 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 3115, win 1040, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248029 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 4515, win 1035, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248029 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 5915, win 1030, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248029 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 7315, win 1025, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248029 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 8715, win 1020, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248029 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 10115, win 1015, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248030 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 11515, win 1010, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.248030 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 12915, win 1005, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.259087 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [.], ack 13295, win 1004, options [nop,nop,TS val *** ecr ***], length 0
16:*:*.280400 enx***e50 In IP 203.*.*.1.443 > 10.*.*.118.50838: Flags [P.], seq 4440:5491, ack 13295, win 1004, options [nop,nop,TS val *** ecr ***], length 1051
16:*:*.280921 enx***e50 Out IP 10.*.*.118.50838 > 203.*.*.1.443: Flags [P.], seq 13295:13326, ack 5491, win 77, options [nop,nop,TS val *** ecr ***], length 31
40 packets captured
41 packets received by filter
0 packets dropped by kernel

定位到 MTU

虽然我看不懂 tcpdump 的抓包结果,但是 AI 告诉我说:

从新信息基本可以定位了:代理和 DNS 都不是根因,问题高度集中在“浏览器的大 TLS ClientHello 在移动宽带上行被分片/丢包”。

关键证据:

  1. gsettings mode 是 none,env 无代理;tcpdump 里 Firefox 是直连 23.*.*.38:443,没有走 127.*.*.1:*。代理排除。

  2. Firefox DNS 把 www.microsoft.com 解析到 23.*.*.38,你 ping 这个 IP 0% 丢包;说明 DNS 和基础连通性正常。

  3. tcpdump 第二段:

    • 16:*:*.923 向 23.*.*.38:443 发 SYN
    • 16:*:*.183 收到 SYN-ACK
    • 16:*:*.185 客户端发出 1895 字节的 TLS ClientHello
    • 抓包窗口内没看到服务器对这个 1895 字节的 ACK
  4. 第一段对 146.*.*.91:443 更明显:

    • 客户端发 1902 字节 ClientHello
    • 服务器只 SACK 了 1441:1903,缺 1:1440
    • 客户端重传 1:1440 三次都没成功

    这说明大包上行分片/丢包,而小包正常。

  5. curl 成功是因为 curl 的 ClientHello 只有 512 字节,不触发大包分片;浏览器 ClientHello 有 1.9KB,触发了分片/大包问题。

然后测试 MTU 大小:

1
2
3
ping -M do -s 1472 -c 3 www.microsoft.com
ping -M do -s 1452 -c 3 www.microsoft.com
ping -M do -s 1400 -c 3 www.microsoft.com

MTU 为 1472 时报错:ping: local error: message too long, mtu=1492,别的正常。

接下来把网卡 MTU 依次改成 1400/1480/1492:

1
sudo ip link set dev enx***e50 mtu 1400

再尝试时,发现仅有 1400 可以正常打卡网站。既然这样,那就把 MTU 设成 1400 就好了:

1
2
nmcli connection modify "有线连接" 802-3-ethernet.mtu 1400
nmcli connection up "有线连接"

至此,问题解决。

没有找到根本原因

虽然问题解决了,但是这个问题发生地莫名奇妙,所以我又尝试找了一下发生原因。

首先,可以确定是遇到了 MTUD 黑洞。ping 和 curl 由于数据包较小,远小于 1400,所以能够连通;而浏览器的 TLS ClientHello 约 1.9KB,会触发分片,导致数据被分成了两个大小分别为 1460 字节 435 字节的数据包,由于较大的数据包超出数据包大小限制,导致被丢弃。

但是问题是,为什么较大的数据包会超出数据包大小限制呢?按理来讲,计算机应该有机制使得终端设备知晓数据包大小限制才对。

进一步查找资料发现,当数据包过大时,会返回 ICMP Type 3 Code 4 消息。如果 ICMP 消息被拦截了,就会导致计算机无法获取到数据包大小限制。

为了我监测我的电脑上的情况,先将 MTU 设会 1500,然后同时执行 sudo tcpdump -ni any icmp 和 ping -M do -s 1472 -c 3 www.microsoft.com。

结果为:

1
2
3
4
5
6
7
8
$ ping -M do -s 1472 -c 3 www.microsoft.com
PING e13678.*.*.net (23.*.*.100) 1472(1500) bytes of data.
From 172.*.*.6 icmp_seq=1 Frag needed and DF set (mtu = 1492)
ping: local error: message too long, mtu=1492
ping: local error: message too long, mtu=1492

--- e13678.*.*.net ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2021ms
1
2
3
4
5
$ sudo tcpdump -ni any 'icmp[0] = 3 and icmp[1] = 4'
tcpdump: data link type LINUX_SLL2
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 262144 bytes
17:03:09.482838 enx00e04c391e50 In IP 172.*.*.6 > 10.*.*.118: ICMP 23.*.*.100 unreachable - need to frag (mtu 1492), length 36

可以看到,ICMP 消息没有被拦截,但是返回的 MTU 为 1592,比我之前试出来的 1400 要大一些。

再用 tracepath 测试:

1
2
3
4
5
6
7
8
9
10
11
$ tracepath -n 23.220.110.38
1?: [LOCALHOST] pmtu 1500
1: 10.*.*.254 4.170ms
1: 10.*.*.254 2.483ms
2: 172.*.*.6 1.919ms
3: 172.*.*.6 2.902ms pmtu 1492
3: 100.*.*.1 3.893ms
...
Too many hops: pmtu 1492
Resume: pmtu 1492

得到的 MTU 确实是 1492。但是,之前试出来的 MTU 最大为 1400。所以猜测可能中间的节点中 MTU 最小的设备为 1400,但是由于一些问题,如:被防火墙拦截、NAT转发出错或是该 MTU 最小的节点没有发送 ICMP,导致我的电脑没有得到正确的最小 MTU。

但具体是那个节点出了问题,最小 MTU 值为什么没有被传回等更具体的原因,就不是我所能知道的了。

浪费我时间

这个问题浪费了我整整一下午时间,关键是我作业还一笔没动呢……

真是折腾人。但是我不得不解决这个问题,不然就只能用流量上网了。

参考资料

  1. G第65篇:网络排障“鬼见愁”:小包通、大包断?深度拆解路径MTU发现(PMTUD)原理与实战 - 知乎
使用 Hexo 构建 | 主题 Lengux (有修改)| © 2026 SLIGHTNING