On my Android phone, where I have a Debian system running in userspace (apt, GNU tools, and other software runs in a chroot, accessible through ssh), the routing table seems incomplete.

Output of ip route -all -details show:

unicast dev wlan0 proto kernel scope link src 
unicast dev p2p-p2p0-0 proto kernel scope link src 

Output of ip route get via via ??? ??? dev wlan0 src 

Where does it get from? That is indeed the correct gateway, but the routing table output does not show it. I can also reach external addresses.

Questioning my sanity, I tried another tool, and when that gave me the same output, I found a way to ask the kernel directly:

$ route -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface   U     0      0        0 wlan0   U     0      0        0 p2p-p2p0-0

$ cat /proc/net/route
Iface   Destination Gateway     Flags   RefCnt  Use Metric  Mask        MTU Window  IRTT
wlan0   0002A8C0    00000000    0001    0   0   0   00FFFFFF    0   0   0
p2p-p2p0-0  002BA8C0    00000000    0001    0   0   0   00FFFFFF    0   0   0

The device is operating in "WiFi bridge" mode, where it is connected to a WiFi network and offers a hotspot at the same time; hence the two local networks. The kernel is a:

$ uname -a
Linux localhost 4.1.18-g0fcbc9f #1 SMP PREEMPT Thu Dec 28 10:57:06 CST 2017 armv7l GNU/Linux

Where is this magic default route coming from?


The standard ip route program doesn't know the options -all or -details, so you probably have an Android specific version here.

There might be routing entries in tables other than the default.

Assuming your ip command is compatible to the standard ip, run

ip rule

You should see a list of tables, at least

0:      from all lookup local 
32766:  from all lookup main 
32767:  from all lookup default 

Then you can examine each of them

ip route show table 32767

And so on with the table numbers from the list above.

  • In table 0 I see default via dev wlan0, that makes sense. If you know, could you elaborate on why this doesn't show up in the routing table where it usually does? – Luc Sep 17 '18 at 18:35
  • Sorry, might be something Android specific. – RalfFriedl Sep 17 '18 at 22:33
  • table 0 aka unspec (not to be confused with rule 0 which uses table 255 aka local) appears to be a special table which displays an aggregate of all other tables. So if an entry is seen in table 0, it's probably in an other more useful table. Doesn't seem android specific. What to examine here would be tables 253 (default, usually empty), 254 (main, the one used when not using the table keyword) and 255 (local) not 32767 which here is a rule pointing to a table, not a table. Of course tables 0-4294967295 are available if rules points to them, eg strongswan uses table 220 by default. – A.B Sep 29 '18 at 12:47
  • The first column of the ip rule output is not the table id but the table rule priority, so ip route show table 32767 would be empty as the default table id is not 32767 but 253. "Priority: 32767, Selector: match anything, Action: lookup routing table default (ID 253)." – andresp Jul 19 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.