Friday, January 30, 2009

IPv6 update!

Just for posterity's sake, this is what I'm using now for 6to4 on my DD-WRT v24sp1 router. (They said it couldn't be done, proving once again that "they" aren't usually that bright.)

I'm using the following startup script:

sleep 5
insmod ipv6
WANIP=$(ip -4 addr show dev eth1 | awk '/inet/ {print $2}' | cut -d/ -f1)
if [ -n "$WANIP" ]
V6PREFIX=$(printf '2002:%02x%02x:%02x%02x' $(echo $WANIP | tr . ' '))
ip tunnel add tun6to4 mode sit ttl 255 remote any local $WANIP
ip link set tun6to4 mtu 1280
ip link set tun6to4 up
ip addr add $V6PREFIX:0::1/16 dev tun6to4
ip addr add $V6PREFIX:1::1/64 dev br0
ip -6 route add 2000::/3 via :: dev tun6to4

Here is my Radvd configuration:

interface br0 {
MinRtrAdvInterval 3;
MaxRtrAdvInterval 10;
AdvLinkMTU 1280;
AdvSendAdvert on;
prefix 0:0:0:1::/64 {
AdvOnLink on;
AdvAutonomous on;
AdvValidLifetime 86400;
AdvPreferredLifetime 86400;
Base6to4Interface eth1;
AdvRouterAddr on;

This configuration autodetects the external IPv4 address and uses that to compute everything else, so it should work unmodified on your router. (If it doesn't work for you, the most likely problem will be the external interface - it changed from vlan1 to eth1 between v23 and v24, which really threw me off for a while.)

The only remaining problem with this configuration is that Radvd doesn't come up automatically when the router boots up, which means that while the router will have IPv6 connectivity, but none of the hosts on your network will. As a workaround, you can go into the Administration menu in the web interface to disable/enable Radvd, after which it should work. (Suggestions for a real solution are welcome!)

If you find yourself having to debug IPv6 issues, by the way, is an invaluable tool.

1 comment:

Kiriska said...

This, coupled with Nick's questionable Facebook-status-updating methods, seems to contribute another item to the list of reasons why I never really fit the CS-major mold. :O