我可以连接到谷歌,但不能连接到 duckduckgo。
$ ping google.com
PING google.com(arn09s19-in-x0e.1e100.net (2a00:1450:400f:80c::200e)) 56 data bytes
64 bytes from arn09s19-in-x0e.1e100.net (2a00:1450:400f:80c::200e): icmp_seq=1 ttl=116 time=15.4 ms
64 bytes from arn09s19-in-x0e.1e100.net (2a00:1450:400f:80c::200e): icmp_seq=2 ttl=116 time=16.5 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 15.362/15.916/16.471/0.554 ms
$ ping duckduckgo.com
ping: connect: Network is unreachable
我认为这是因为 google 有 ipv6 而 duckduckgo 没有,如 nslookup 所示。
$ nslookup google.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: google.com
Address: 216.58.207.238
Name: google.com
Address: 2a00:1450:400f:80c::200e
$ nslookup duckduckgo.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: duckduckgo.com
Address: 52.142.124.215
这同样适用于具有 ipv6 并且可以运行的 facebook.com,以及没有 ipv6 并且不能正常运行的 github.com。
我买了一根直接插入路由器的网线,问题依然存在。但当我关闭 wifi、拔掉网线并通过我的 Android 智能手机使用 USB 网络时,一切正常(智能手机的移动数据已关闭,并连接到 wifi)。我的室友的设备没有出现连接问题。我使用这台电脑已经一年了,问题直到今天早上才开始出现。
我能做些什么吗?
我尝试过的解决方案
我在看这个帖子。建议的解决方案是在 wifi 的图形配置中禁用 ipv4,并在 wifi 的 ipv6 设置中将“方法”设置为“自动,仅地址”。我的设置中没有此选项,将其设置为“自动”或“自动,仅地址”没有任何变化。
我也试过此解决方案
$ sudo dhclient -r wlp2s0
Killed old client process
$ sudo dhclient wlp2s0
这并没有解决问题,但是改变了 ping 的错误信息:
$ ping duckduckgo.com
PING duckduckgo.com (52.142.124.215) 56(84) bytes of data.
From _gateway (192.168.1.1) icmp_seq=10 Destination Net Unreachable
^C
--- duckduckgo.com ping statistics ---
32 packets transmitted, 0 received, +1 errors, 100% packet loss, time 31690ms
编辑
usb0 是我的 Android 设备。
ip route 的输出:
$ ip route
default via 192.168.42.129 dev usb0 proto dhcp metric 100
default via 192.168.1.1 dev wlp2s0 proto dhcp metric 600
169.254.0.0/16 dev wlp2s0 scope link metric 1000
192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.33 metric 600
192.168.42.0/24 dev usb0 proto kernel scope link src 192.168.42.224 metric 100
路线输出
$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default _gateway 0.0.0.0 UG 100 0 0 usb0
default _gateway 0.0.0.0 UG 600 0 0 wlp2s0
link-local 0.0.0.0 255.255.0.0 U 1000 0 0 wlp2s0
192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp2s0
192.168.42.0 0.0.0.0 255.255.255.0 U 100 0 0 usb0
ifconfig 的输出:
$ ifconfig
enx00e04e3a4476: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.36 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2001:4646:58b8:0:1de0:9fed:a9ea:a5d7 prefixlen 64 scopeid 0x0<global>
inet6 fe80::a9bd:79ab:e302:83ff prefixlen 64 scopeid 0x20<link>
inet6 2001:4646:58b8:0:bec2:942:e66:f0da prefixlen 64 scopeid 0x0<global>
inet6 2001:4646:58b8:0:cd74:eed2:2eb2:e437 prefixlen 128 scopeid 0x0<global>
ether 00:e0:4e:3a:44:76 txqueuelen 1000 (Ethernet)
RX packets 315 bytes 38645 (38.6 KB)
RX errors 0 dropped 3 overruns 0 frame 0
TX packets 468 bytes 62610 (62.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 12520 bytes 1072501 (1.0 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12520 bytes 1072501 (1.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.42.239 netmask 255.255.255.0 broadcast 192.168.42.255
inet6 fe80::732b:158e:d3d9:4409 prefixlen 64 scopeid 0x20<link>
ether 96:bf:5c:93:c0:7a txqueuelen 1000 (Ethernet)
RX packets 1370 bytes 426638 (426.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1581 bytes 412547 (412.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.33 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::6f50:6f2d:d7a8:f848 prefixlen 64 scopeid 0x20<link>
inet6 2001:4646:58b8:0:650e:8cfb:7323:d714 prefixlen 64 scopeid 0x0<global>
inet6 2001:4646:58b8:0:15bb:278d:a998:f4d prefixlen 128 scopeid 0x0<global>
inet6 2001:4646:58b8:0:d72d:2a87:de99:4f79 prefixlen 64 scopeid 0x0<global>
ether 74:c6:3b:7f:3c:e9 txqueuelen 1000 (Ethernet)
RX packets 78154 bytes 52156567 (52.1 MB)
RX errors 0 dropped 4424 overruns 0 frame 0
TX packets 32789 bytes 4744530 (4.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
答案1
回答我自己的问题
违反直觉的是,问题出在路由器上,而不是 Ubuntu。我觉得这违反直觉,因为互联网在连接到路由器的所有其他设备(我的智能手机和室友的电脑)上都能正常工作。然而,一位室友也遇到了同样的问题,所以问题肯定出在路由器上。
结论
如果路由器适用于除您的设备之外的所有设备,则并不一定意味着这是您的设备的故障。