我现在住的地方,互联网连接(有线)显示出以下奇怪的症状。它们似乎与我使用主机名还是 IP 地址无关。
- ping 工作正常
- Skype 可以使用
- Wget 连接,但从未收到响应。 (一直等待“HTTP 请求已发送,等待响应”,直到超时。)
- 除了它适用的一小部分域之外。
- ssh 命令 (
ssh host ls
) 有效。 - 交互式 ssh 可以工作很短一段时间,但很快就会挂起,例如在第一次时
ls
- 每次都在同一点。 - 在 Windows 下,一切正常。
我该怎么做才能进一步诊断?到目前为止,我只关注应用层。由于存在明显的互联网连接,因此必须有某种方法来隧道 Firefox,但我想首先确定问题所在。
这很可能与大数据包无法通过有关。我发现有一个 MTU,但是将其设置为 eth0 并不能解决我的问题。我认为我在 PPPOE 和路由器后面。 Windows 和 Linux 上的外部 IP 相同。
一些命令的输出:
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1024 qdisc mq state UP qlen 1000
link/ether 00:26:aa:aa:aa:61 brd ff:ff:ff:ff:ff:ff
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether c4:17:aa:aa:aa:ff brd ff:ff:ff:ff:ff:ff
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 5e:49:aa:aa:aa:27 brd ff:ff:ff:ff:ff:ff
ip route show
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.4 metric 1
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
169.254.0.0/16 dev eth0 scope link metric 1000
default via 192.168.1.1 dev eth0 proto static
ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1024 qdisc mq state UP qlen 1000
link/ether 00:26:2d:78:ac:61 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.4/24 brd 192.168.1.255 scope global eth0
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether c4:17:fe:3b:56:ff brd ff:ff:ff:ff:ff:ff
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 5e:49:01:03:55:27 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
inet6 fe80::5c49:1ff:fe03:5527/64 scope link
valid_lft forever preferred_lft forever
我可以发送大小最大为 1468 的 ping。
tim@milagros:/$ ping -M do -c 1 -s 1470 stackexchange.com
PING stackexchange.com (64.34.119.12) 1470(1498) bytes of data.
--- stackexchange.com ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms
tim@milagros:/$ ping -M do -c 1 -s 1468 stackexchange.com
PING stackexchange.com (64.34.119.12) 1468(1496) bytes of data.
1476 bytes from stackoverflow.com (64.34.119.12): icmp_seq=1 ttl=52 time=176 ms
--- stackexchange.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 176.539/176.539/176.539/0.000 ms
tim@milagros:~/projekt/perl$ ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:26:2d:78:ac:61
inet addr:192.168.1.4 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:161 errors:0 dropped:0 overruns:0 frame:0
TX packets:194 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:143947 (143.9 KB) TX bytes:67727 (67.7 KB)
Interrupt:16
答案1
Tim,我恭敬地敦促您忽略对更改 MTU 的疑虑。你的问题里写满了 MTU 问题,而我已经成为一名专业网络工程师超过 15 年了。
DF
要证明 MTU 是否有帮助,请使用 ping 以及IP 标头中设置的位在 Linux 计算机上进行测试...
ping -M do -s 1232 <some pingable internet ip address>
我计算-s
参数时假设您的 PPPoE IP MTU 为 1300 字节。如果 ping 成功,则使用-s 1472
并观察会发生什么...如果 ping 现在失败,则您有确凿的证据表明存在 MTU 问题(假设您没有将以太网链路 MTU 设置得更低)。仅供参考,-s 1472
将发送 1500 字节的以太网有效负载回显请求;-M do -s 1472
发送相同的 1500 字节有效负载,并在 IP 标头中设置 DF 位。
另请记住,MTU 必须设置为两个都链接的两侧...所以您也需要在调制解调器上执行此操作。
编辑
蒂姆,你还是没有运行我要求你执行的命令。让我举一个例子来说明您所做的事情有什么问题(我需要将目标主机修改为 stackexchange.com,因为在我的 8.8.8.8 路径中存在针对 IP 碎片的防火墙)
反面例子(使用你的 ping 标志)
[mpenning@Bucksnort ~]$ ping -c 1 -s 65507 64.34.119.12
PING 64.34.119.12 (64.34.119.12) 65507(65535) bytes of data.
65515 bytes from 64.34.119.12: icmp_seq=1 ttl=51 time=53.2 ms
--- 64.34.119.12 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 53.246/53.246/53.246/0.000 ms
[mpenning@Bucksnort ~]$
反问:64KB 的 ping 数据包如何通过 1500 字节的以太网段? (参见尾注 A)除非您发布我所要求的信息,否则我无能为力。这是同一个例子,ping -M do
正面例子
[mpenning@Bucksnort ~]$ ping -M do -c 1 -s 65507 64.34.119.12
PING 64.34.119.12 (64.34.119.12) 65507(65535) bytes of data.
From 24.102.60.3 icmp_seq=1 Frag needed and DF set (mtu = 1500)
--- 64.34.119.12 ping statistics ---
0 packets transmitted, 0 received, +1 errors
[mpenning@Bucksnort ~]$
ping -M do
提供有关沿路径的最大 MTU 的信息(在本例中,我们知道第一跳以太网段的值为IP MTU
1500 字节)。
尾注:
答:您的 ping 可以作为一系列 IP 片段来完成,因为默认情况下ping
允许 IP 片段。如果您试图找到将通过链路的最大数据包大小,您必须修改IP头(我用 进行了说明-M do
),以确保您最终不会得到一堆零散的响应缝合在一起。使用ping -c 1 -s 65507 64.34.119.12
:
[mpenning@Bucksnort ~]$ sudo tshark -n -i eth0 icmp
1 0.000000 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=0)
2 0.000058 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=1480)
3 0.000071 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=2960)
4 0.000081 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=4440)
5 0.000094 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=5920)
6 0.000105 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=7400)
7 0.000116 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=8880)
8 0.000124 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=10360)
9 0.000133 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=11840)
10 0.000143 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=13320)
11 0.000152 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=14800)
12 0.000162 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=16280)
13 0.000172 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=17760)
14 0.000181 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=19240)
15 0.000191 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=20720)
16 0.000201 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=22200)
17 0.000211 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=23680)
18 0.000221 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=25160)
19 0.000230 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=26640)
20 0.000240 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=28120)
21 0.000250 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=29600)
22 0.000259 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=31080)
23 0.000269 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=32560)
24 0.000278 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=34040)
25 0.000288 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=35520)
26 0.000298 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=37000)
27 0.000308 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=38480)
28 0.000318 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=39960)
29 0.000327 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=41440)
30 0.000337 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=42920)
31 0.000352 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=44400)
32 0.000361 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=45880)
33 0.000372 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=47360)
34 0.000384 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=48840)
35 0.000394 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=50320)
36 0.000403 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=51800)
37 0.000411 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=53280)
38 0.000419 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=54760)
39 0.000428 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=56240)
40 0.000437 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=57720)
41 0.000446 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=59200)
42 0.000455 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=60680)
43 0.000466 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=62160)
44 0.000477 24.102.60.3 -> 64.34.119.12 IP Fragmented IP protocol (proto=ICMP 0x01, off=63640)
45 0.000486 24.102.60.3 -> 64.34.119.12 ICMP Echo (ping) request
46 0.044402 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=0)
47 0.044439 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=1480)
48 0.044899 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=2960)
49 0.044910 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=4440)
50 0.044916 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=5920)
51 0.045149 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=7400)
52 0.045399 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=8880)
53 0.045409 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=10360)
54 0.045415 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=11840)
55 0.045649 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=13320)
56 0.045899 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=14800)
57 0.045908 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=16280)
58 0.045915 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=17760)
59 0.046148 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=19240)
60 0.046163 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=20720)
61 0.046402 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=22200)
62 0.046421 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=23680)
63 0.046650 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=25160)
64 0.046668 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=26640)
65 0.046901 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=28120)
66 0.046918 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=29600)
67 0.047151 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=31080)
68 0.047171 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=32560)
69 0.047399 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=34040)
70 0.047418 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=35520)
71 0.047424 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=37000)
72 0.047650 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=38480)
73 0.047900 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=39960)
74 0.048149 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=41440)
75 0.048165 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=42920)
76 0.048172 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=44400)
77 0.048178 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=45880)
78 0.048398 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=47360)
79 0.048650 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=48840)
80 0.048667 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=50320)
81 0.048674 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=51800)
82 0.048900 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=53280)
83 0.048922 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=54760)
84 0.049150 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=56240)
85 0.049174 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=57720)
86 0.049398 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=59200)
87 0.049649 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=60680)
88 0.049671 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=62160)
89 0.049677 64.34.119.12 -> 24.102.60.3 IP Fragmented IP protocol (proto=ICMP 0x01, off=63640)
90 0.049683 64.34.119.12 -> 24.102.60.3 ICMP Echo (ping) reply