Classless routing and Android
I wrote in February 2010 about how to use Classless Routing to distribute static routes via DHCP.
More recently I've rebuilt my server and bought an Android phone. Which doesn't work on my network. A quick search throws up Android bug 10315. The issue is Android sets up the static routes, but fails to apply the default router.
Although, according to RFC 3342:
If the DHCP server returns both a Classless Static Routes option and
a Router option, the DHCP client MUST ignore the Router option.
So it turns out, it's not a bug and whoever wrote the network code used in Android was spot on. So what to do? Add your default gateway into your classless routes options. Very simply, use 0 as your significant bit and then provide the router address.
Working example:
You have a second network you want to route to: 10.0.0.0/255.255.255.0 and a router on the address 192.168.1.100. So you setup your static route:
option classless-route 24,10,0,0,192,168,1,100
But to get to the Internet you need to go to the router on 192.168.1.254. So this is where it goes pete tong. Add the default route "0" and the router to the end of your string:
0,192,168,1,254
Our config looks something like this in the end:
option classless-routes code 121 = array of unsigned integer 8; # blah blah subnet 192.168.1.0 netmask 255.255.255.0 { option classless-routes 24,10,0,0,192,168,1,100 0,192,168,1,254; # more blah }
I've updated the Android bug to reflect this, lets see how long it is until Google closes the bug!