IPv6 Woes...

So, I'm in a bit of an odd situation where I've got 2 (sometimes 3) stateless ipv6 configurations hitting my laptop a lot of the time - I need to prefer only one of them for the default route, but obviously I'm getting served default routes all over the shop (because each radvd on that network is advertising itself as a default route too)... Now, on my laptop I actually deliberately set one of my own machines as a DNS server on the bringing up of a certain interface which happens to be v6 only, the problem is that only does recursive if you come from a fixed set of IPs, so I get sporadic dns failures if the laptop decides to use one of the other default v6 routes.

Now, being spoilt as I usually am by the kernel, I thought "Hmmm, obvious way to get round this would be to tell the kernel that $interface should have a default routing metric for the default route of 512 rather than 1024". Apparently that was a pipe dream, from what I can tell from the kernel source, routes added are given a metric of 256 if they are a directly advertised prefix, and 1024 if they are a default route, I couldn't see a way that you could at any point change that.

As this doesn't actually exist, and I just realised that I could advertise the route to the dns server (which is on a different /64 to the vpns /64), I'm now advertising that route - note, however, that for this to work you have to have enable a sysctl option to let it accept router advertisements for things that aren't the prefix it's getting or the default.

The way to enable that is

sudo sysctl net.ipv6.conf.interface.accept_ra_rt_info_max_plen=64

Which will enable anything up to a /64 prefix to be advertised at us.

Looking at how the kernel handles default routing tables, what would be really useful (to me at least) would be to be able to set default metrics per interface so that when a route is advertised at it it used the per interface metric rather than the (sortof) hardcoded kernel metrics.

Posted: 2011-04-06 14:03 in Tech | permalink