Enable IPv6 on your Raspberry PI

posted on 2013-01-27

All devices should have an IP address. To enable IPv6 support on your Raspbian, do the following.

Add the line ipv6 to the file /etc/modules. This will make sure that IPv6 support is loaded into the kernel at the next boot.

Then open the file /etc/dhcp/dhclient.conf and add an dhcp6.domain-search, dhcp6.fqdn, dhcp6.name-servers, dhcp6.sntp-servers; as options to the request line. And just for good measure, post your hostname as the fully qualified domain by adding the line send fqdn.fqdn = gethostname(); just after send host-name = gethostname();.

Reboot, and you should have IPv6 DHCP running.

Verify with ifconfig or if you have a browser use test-ipv6.com. I have included the files I currently use for reference below.

/etc/dhcp/dhclient.conf:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name = gethostname();
send fqdn.fqdn = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers,
        dhcp6.domain-search, dhcp6.fqdn,
        dhcp6.name-servers, dhcp6.sntp-servers;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;
# .... more commented out stuff below ....

/etc/modules:

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
# Parameters can be specified after the module name.

snd-bcm2835
ipv6

After enabling all this, I decided to register the IPv6 address to the hostname besje.net, but later found out that none of my mobile devices support IPv6 yet. This means the only way I can test it is with my local home network.

Update: I first thought it would work by adding an iface eth0 inet6 dhcp line to /etc/network/interfaces. But that gave my global IPv6 configuration as link scope some times, meaning that the connection would drop out at the point the ipv4 dhcp came along.