Configure IPv6 on Raspberry Pi
If today we almost use IPv4, the future will certainly be IPv6. Is our Rapsberry ready ? Yes of course. But how to configure it now, even if it is only for test ?
- Update the system
apt-get update && apt-get upgrade -y
- Add automatic loading of the IPv6 module when you start the Raspberry Pi
echo ipv6 >> /etc/modules
Do not immediately restart your Raspberry, You can manually load the module
modprobe ipv6
- Activate the “Privacy Extensions” IPv6
echo "net.ipv6.conf.eth0.use_
tempaddr 2" >> /etc/sysctl.conf echo "net.ipv6.conf.eth0.temp_ prefered_lft 7200" >> /etc/sysctl.conf The first line calls a temporary private address generation.
The second line force the renewal of this address all 7200 s or 2 hours. - Configure the network interface. It goes in the file /etc/network/interfaces :
iface eth0 inet6 static pre-up modprobe ipv6 address FD80::02 netmask 124 gateway FD80::01
The configuration allows you to force a static address on interface eth0, ensure that the ipv6 module is loaded in memory, set the IP, a netmask of 124 what allows to have 16 IPv6 on the network and finally to give the address of the gateway of the network.
- Your Raspberry restart then the display of your interface with the command ifconfig should give you this (My home is eth1 instead of eth0) :
So you can test that the interface works by sending ping requests but in v6 ! I pass on your network configuration to make it work : the gateway/router/etc. It is ping6 who will serve us :
A very big thank you in Jo for this tutorial !