There are probably lots of situation when this can happen, but this is a big mistery for me. Some tools can use the network just fine (wget, dig, apt-get, ...), but some tools are just failing (ping, traceroute, the browser, ...).
For example, I can download a file with 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]
I can resolve the domain with 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
But I can not ping the site (not because the site is not replying to pings, but because Network is unreachable
):
gonvaled@pegasus ~ » ping archive.ubuntu.com
connect: Network is unreachable
Traceroute is also failing:
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
This is my network config (nothing out of the ordinary!):
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
What else could I check to narrow down this issue?
EDIT
There seem to be two things at play here: IPv6 and default gateway. Whenever I enable wlan, I get these routes:
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
Which has a default gateway, and makes IPv4 work fine.
So now I still have two open questions:
- Why don't I get a default gateway with my eth0? (this is the real issue at hand)
- Why does IPv6 does not need a default gateway? (this is what was confusing me all along)
There are two things going on:
1) For your IPv4 settings you do not have a default route configured. It should look something like this:
Since you do not have an IPv4 route specified you cannot route out of your local network.
2) Since you are using IPv6 and IPv4 you are able to get some traffic out when you're using IPv6. If you did a
route -A inet6
orip -6 route
you would most likely see a default route specified.