Impossible to enable ipv6 at boot time through sysctl file in alpine container
Dear support,
I can’t manage to enable ipv6 at boot time.
I am using release 3.8.1
- ip addr
1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
148: eth0@if149: mtu 1500 qdisc noqueue state UP
link/ether 02:42:ac:11:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
valid_lft forever preferred_lft forever
If I try to add an ipv6 address, it doesn’t work
bash-4.4# ip addr add fdf3::100/64 dev eth0
ip: RTNETLINK answers: Permission denied
For you information, docker container was launched with these parameters
docker container run —privileged -it -d -h DOCK10 —name DOCK10 b80cd820830e /bin/bash
This dockerfile was used to generate docker image
FROM docker.io/alpine
RUN apk update
RUN apk add bash
RUN apk add iperf
RUN echo “net.ipv6.conf.all.disable_ipv6 = 0” >
/etc/sysctl.d/00-00-ipv6_enable.conf
RUN echo “net.ipv6.conf.default.disable_ipv6 = 0” >>
/etc/sysctl.d/00-00-ipv6_enable.conf
CMD [“/bin/sh”]
Inside container, I can see that sysctl file has been correctly created
bash# docker container attach DOCK10
bash-4.4# ls -la /etc/sysctl.d/00-00-ipv6_enable.conf
-rw-r—r— 1 root root 74 Sep 25 10:15
/etc/sysctl.d/00-00-ipv6_enable.conf
This file content is correct
bash-4.4# cat /etc/sysctl.d/00-00-ipv6_enable.conf
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
/etc/modules is correct
bash-4.4# cat /etc/modules
af_packet
ipv6
We can see that /etc/sysctl.d/* was not read at boot because old values are still here
bash-4.4# sysctl -a | grep disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1
sysctl: error reading key ‘net.ipv6.conf.all.stable_secret’: I/O
error
net.ipv6.conf.default.disable_ipv6 = 1
sysctl: error reading key ‘net.ipv6.conf.default.stable_secret’: I/O
error
net.ipv6.conf.eth0.disable_ipv6 = 1
sysctl: error reading key ‘net.ipv6.conf.eth0.stable_secret’: I/O
error
net.ipv6.conf.lo.disable_ipv6 = 1
sysctl: error reading key ‘net.ipv6.conf.lo.stable_secret’: I/O error
If I force reading of /etc/sysctl.d/00-00-ipv6_enable.conf, ipv6 will be enabled and everything will work
bash-4.4# sysctl -p /etc/sysctl.d/00-00-ipv6_enable.conf
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
I can now add ipv6 address and there’s no error this time !
bash-4.4# ip addr add fdf3::100/64 dev eth0
bash-4.4# ip –6 addr show dev eth0
148: eth0@if149: mtu
1500 state UP
inet6 fdf3::100/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::42:acff:fe11:2/64 scope link
valid_lft forever preferred_lft forever
Do you confirm that /etc/sysctl.d/* is not read at boot time in alpine
container ?
If so, what is the correct way to enable ipv6 ?
Regards
Nicolas
(from redmine: issue id 9471, created on 2018-09-25, closed on 2018-09-25)