Thursday, June 09, 2011

Enabling IPv6 on Comcast with Buffalo WZR-HP-G300NH

I'm running Buffalo's latest (as of this writing) DD-WRT firmware, V24-SP2 build 16783.

The DD-WRT IPv6 tutorial is in the ballpark, but didn't work for my setup. See the section on 6rd for Comcast-specific scripts; for me, the script never succeeded on startup (I presume because the WAN wasn't up before the script was executed). Here's what actually worked:

  • In the web interface, Administration / Management.
    • IPv6: Enable
    • Radvd: Disable
    • JFFS2: Enable
    • Clean JFF2: Enable (this will format a writable partition where you can store user scripts)
  • Apply, and then reboot the router.
  • For some reason, nslookup 6rd.comcast.net throws a segmentation fault on my router… so the script below shows a hard-coded value IP address. The original script linked above intended to parse the result of nslookup.
  • Use SSH/SCP/SFTP to copy this script onto the router to /jffs/etc/config/ipv6comcast.wanup:

#!/bin/sh
insmod /lib/modules/`uname -r`/kernel/net/ipv6/sit.ko
HOST6RD=69.252.80.66
#nslookup 6rd.comcast.net segfaults
WANIP=$(ip -4 addr show dev eth1 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
if [ -n "$WANIP" ]
then
V6PREFIX=$(printf ' 2001:55c:%02x%02x:%02x%02x' $(echo $WANIP | tr . ' '))
ip tunnel add tun6rd mode sit ttl 255 remote any local $WANIP
ip link set tun6rd mtu 1280
ip link set tun6rd up
ip addr add $V6PREFIX:0::1/32 dev tun6rd
ip addr add $V6PREFIX:1::1/64 dev br0
ip -6 route add 2000::/3 via ::$HOST6RD dev tun6rd
kill -HUP $(cat /var/run/radvd.pid)
fi
echo "interface br0 { \
MinRtrAdvInterval 3; MaxRtrAdvInterval 10; AdvLinkMTU 1280; AdvSendAdvert on; \
prefix $V6PREFIX::/64 { AdvOnLink on; AdvAutonomous on; AdvValidLifetime 86400; \
AdvPreferredLifetime 86400; }; };" \
> /tmp/radvd.conf
radvd -C /tmp/radvd.conf start