IPv6

21 Oct 2005 • 3 min read

IPv6 - the future? Not yet! 😮

The problem as I see it is that it's too complicated for end users. Even though I'm the maintainer of Gentoo networking scripts, I know nada about IPv6. It's too complicated. Well it's actually quite easy, it's the documentation thats too complicated.

So here's a quick and easy for IPv6 on the home network 😃

  1. Enable IPv6 in the kernel
  2. Add "ipv6" to your USE flags
  3. emerge -uaDvN world to get everything recompiled for ipv6
  4. emerge iproute2 and baselayout-1.12.0 as you'll get much better ipv6 support 😃

Now we have a Gentoo IPv6 system, let's get to the meat! 😄

If you look at the output from ip addr you get something like this inet6 fe80::230:48ff:fe54:45a6/64 scope link

That shows an IPv6 address encoded with your NICs MAC address.

In simple terms, the network prefix is fe80::/64 - this is akin to a subnet (255.255.255.0 or /24) 230:48ff:fe54:45a6 is based off the mac address.

Now fe80 is non routeable anywhere - it's just on your PC. So we need a routeable private IPv6 prefix - like 192.168. in IPv4 terms. Prefixes you can use are fecx, fedx, feex and fefx. For this example we'll use fec0.

Now, we combine these two bits of information to create a routeable IPv6 address fec0::230:48ff:fe54:45a6/64. Lets add this to conf.d/net

config_eth0=( "196.168.0.1/24" "fec0::230:48ff:fe54:45a6/64" )

Restart net.eth0 and you have a site local IPv6 address 😃

Lastly, we need to inform other machines about the IPv6 subnet. Todo that, we use radvd, so emerge it. Then slap this into /etc/radvd.conf

interface eth0
{
    AdvSendAdvert on;
    prefix fec0::/64
    {
        AdvOnLink on;
        AdvAutonomous on;
        AdvRouterAddr off;
    };
};

Start radvd (/etc/init.d/radvd start) and hey presto, all IPv6 capable machines will now have their own IPv6 address as radvd configures a stateless network.

Thats it 😄

So what's missing? Well, DHCP information for starters. IPv6 stateless config does not cater for this. You could emerge dhcpv6 and put a dhcp6s server and and get dhcp6c clients in use, but they don't do any dyanmic dns and I can't find an easy way to enable that. You could write a script on the server to parse the leases file and update a hosts file with the ipv6 info and then hup dnsmasq which can read host files but that's klunky. Especially as the hostname has to be coded into the dhcp6c.conf (just like dhclient - it cannot be specified on the commandline for some obscure reason).

But as we're using IPv6 addreses based on MAC addresses, they won't change. And they're unique. So the best solution is to put the addresses into a /etc/hosts file or install a DNS server to translate the name into an IPv6 address - dnsmasq is very good for this.

Lastly, because radvd is just broadcasting subnet information there is no gateway/default route. This is because my ADSL router and ISP don't handle IPv6 so it's pointless setting one. You'll probably be in the same boat for a while, so ......

I'll look into a 6to4 tunnel so I can use IPv6 across my IPv4 only adsl router and access IPv6 on the internet. I'll even blog about it when I get it working 😃

Thanks to johnm, tigger^ and brix in #gentoo-dev on irc.freenode.net for helpful stuff 😃

Resources