发生这种情况时可能会有很多情况,但这对我来说是一个很大的谜团。 一些工具可以很好地使用networking(wget,dig,apt-get,…),但是一些工具只是失败(ping,traceroute,浏览器…)。
例如,我可以用wget下载一个文件:
gonvaled@pegasus ~ » wget archive.ubuntu.com --2014-10-02 10:52:34-- http://archive.ubuntu.com/ Resolving archive.ubuntu.com (archive.ubuntu.com)... 2001:67c:1360:8c01::18, 2001:67c:1360:8c01::19, 91.189.91.14, ... Connecting to archive.ubuntu.com (archive.ubuntu.com)|2001:67c:1360:8c01::18|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 671 [text/html] Saving to: 'index.html.2' 100%[========================================================================================================================================================>] 671 --.-K/s in 0s 2014-10-02 10:52:34 (30,8 MB/s) - 'index.html.2' saved [671/671]
我可以用dig解决这个问题:
gonvaled@pegasus ~ » dig archive.ubuntu.com ; <<>> DiG 9.9.5-3-Ubuntu <<>> archive.ubuntu.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36593 ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;archive.ubuntu.com. IN A ;; ANSWER SECTION: archive.ubuntu.com. 572 IN A 91.189.92.200 archive.ubuntu.com. 572 IN A 91.189.91.15 archive.ubuntu.com. 572 IN A 91.189.91.14 archive.ubuntu.com. 572 IN A 91.189.91.13 archive.ubuntu.com. 572 IN A 91.189.88.153 archive.ubuntu.com. 572 IN A 91.189.88.149 archive.ubuntu.com. 572 IN A 91.189.92.201 ;; Query time: 2 msec ;; SERVER: 10.11.0.1#53(10.11.0.1) ;; WHEN: Thu Oct 02 10:58:00 CEST 2014 ;; MSG SIZE rcvd: 148
但是我不能ping通网站(不是因为网站不回应Ping,而是因为Network is unreachable ):
gonvaled@pegasus ~ » ping archive.ubuntu.com connect: Network is unreachable
Traceroute也失败了:
gonvaled@pegasus ~ » traceroute archive.ubuntu.com traceroute to archive.ubuntu.com (91.189.88.149), 30 hops max, 60 byte packets connect: Network is unreachable
这是我的networkingconfiguration(没有什么不寻常的!):
gonvaled@pegasus ~ » ifconfig eth0 eth0 Link encap:Ethernet HWaddr 2c:76:8a:e0:b0:6b inet addr:10.11.44.84 Bcast:10.11.255.255 Mask:255.255.0.0 inet6 addr: 2001:4dd0:fff4:11:2c3f:5f86:f975:579f/64 Scope:Global inet6 addr: fe80::2e76:8aff:fee0:b06b/64 Scope:Link inet6 addr: 2001:4dd0:fff4:11:2e76:8aff:fee0:b06b/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:37502 errors:0 dropped:0 overruns:0 frame:0 TX packets:14119 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:13558552 (13.5 MB) TX bytes:3533448 (3.5 MB) gonvaled@pegasus ~ » route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.11.0.0 * 255.255.0.0 U 0 0 0 eth0 link-local * 255.255.0.0 U 1000 0 0 eth0
我还能检查什么来缩小这个问题的范围?
这里似乎有两件事:IPv6和默认网关。 每当我启用无线局域网,我得到这些路线:
gonvaled@pegasus ~ » route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 10.11.0.1 0.0.0.0 UG 0 0 0 wlan0 10.11.0.0 * 255.255.0.0 U 0 0 0 eth0 10.11.0.0 * 255.255.0.0 U 9 0 0 wlan0 link-local * 255.255.0.0 U 1000 0 0 eth0
其中有一个默认网关,并使IPv4工作正常。
所以现在我还有两个开放的问题:
有两件事情正在进行:
1)对于您的IPv4设置,您没有configuration默认路由。 它应该看起来像这样:
$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 10.11.0.0 0.0.0.0 UG 100 0 0 eth0 10.11.0.0 * 255.255.0.0 U 0 0 0 eth0
由于您没有指定IPv4路由,所以无法从您的本地networking发出路由。
2)由于您使用的是IPv6和IPv4,因此在使用IPv6时可以获得一些stream量。 如果您执行了route -A inet6或ip -6 route您很可能会看到指定的默认路由。