Dirk's Tech Findings

Alpine: IPv6 configuration

Publication date: 2020-10-06

Issue: Alpine Linux IPv6 configuration is different than for Debian

The usual configuration in "/etc/network/interfaces" fails on Alpine Linux:

iface eth0 inet6 auto

Solution: Accept route advertisements

To do Stateless Address Autoconfiguration (SLAAC), one needs to configure in "/etc/network/interfaces" the following:

iface eth0 inet6 manual
    pre-up echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_ra

However, this does not work if IPv6 forwarding is enabled (net.ipv6.conf.all.forwarding=1). According to the kernel documentation, setting accept_ra to value "2" should work in this case. But it does not work if set in "/etc/network/interfaces". It seems that "sysctl.conf" is applied after "/etc/network/interfaces" and enabling forwarding resets accept_ra to 1. One can set accept_ra is "sysctl.conf" after enabling forwarding to work around this:

net.ipv6.conf.eth-inet.accept_ra=2
#Alternatively, the following would work, too:
#net.ipv6.conf.eth0.forwarding=0

Hint towards the solution

Back to topic list...