06.09
Seems I’m a little late to the game today, but after arriving at work and seeing that IPv6 was available on the network that one of my FreeBSD boxen happens to sit on, I wanted to give this a try. If nothing else, I wanted to see that elusive dancing turtle.
Fortunately, in FreeBSD 7.1 and higher, all the pieces you need to connect to an IPv6 network are already there, they just need to be turned on. Enabling IPv6 support is simple, just add the following line to your /etc/rc.conf:
ipv6_enable="YES"
If your host has other network interfaces that are not on an IPv6-enabled network, or not connected at all, it wouldn’t be a bad idea to explicitly define which interfaces IPv6 should run on. To do so, include this in /etc/rc.conf as well:
## 'em0' is the device ID of the NIC you want IPv6 running on ipv6_network_interfaces="em0"
After adding that, restart the machine and feel the magic. If the routers on the network you are connected to are configured to support IPv6 traffic, you should be able to run “ifconfig” from the shell, and see two “inet6″ addresses listed. The one starting with “fe80::” is the link-local address, which is analogous to auto-configured IPv4 addresses that begin with “169.254…” You can run a ping6 to check outbound connectivity:
haruhi# ping6 www.kame.net PING6(56=40+8+8 bytes) <your IPv6 address> --> 2001:200:dff:fff1:216:3eff:feb1:44d7 16 bytes from 2001:200:dff:fff1:216:3eff:feb1:44d7, icmp_seq=0 hlim=49 time=205.078 ms 16 bytes from 2001:200:dff:fff1:216:3eff:feb1:44d7, icmp_seq=1 hlim=49 time=204.910 ms 16 bytes from 2001:200:dff:fff1:216:3eff:feb1:44d7, icmp_seq=2 hlim=49 time=204.736 ms ^C
If you have a custom IPFW firewall script set up, you may find that you still have no IPv6 connectivity. This is because your firewall is blocking search responses from the default router on the local network. So before you reboot, be sure to add a few lines to your ipfw rules file:
## IPv6 stuff ipfw -q add 30 deny ip6 from any to ::1 ipfw -q add 31 deny ip6 from ::1 to any ipfw -q add 32 allow ipv6-icmp from :: to ff02::/16 ipfw -q add 33 allow ipv6-icmp from fe80::/10 to fe80::/10 ipfw -q add 34 allow ipv6-icmp from fe80::/10 to ff02::/16 # ipfw -q add 35 allow ipv6-icmp from any to me6 ip6 in
Of course, if you have “ipfw -q add” assigned to a variable in your script, by all means use your variable instead. Lines 30 and 31 prevent the loopback interface from interacting with real networks, and 32-34 allow icmp traffic from multicast or link-local networks (which will allow your machine to receive search responses when it looks for a default router.) 35 allows any inbound IPv6 icmp traffic, which if you already allow icmp traffic from anywhere via IPv4 (pings and the like), then feel free to leave this line uncommented.
Update: A friend of mine pointed out that since I’ve got full IPv6 connectivity, I may as well be using IPv6 DNS servers as well. Setting them is trivial — just switch out your IPv4 entries in /etc/resolv.conf for IPv6 addresses. I found the IPv6 addresses of our onsite DNS servers with the dig command, but the OpenDNS servers will work just the same. Just add the following:
## OpenDNS IPv6 addresses nameserver 2620:0:ccc::2 nameserver 2620:0:ccd::2
If you want, leave the IPv4 servers in there at the end of the file as a fallback, but this shouldn’t be necessary — the above configuration can resolve IPv4 addresses just fine. Save the changes, and you should be all set. If you use nslookup or dig to look a hostname up, you should see one of your IPv6 nameserver addresses in the “SERVER” section of the response.