Hi All,
I have been able to disable IPv6 globally by adding the following sysctls to the /etc/sysctl.conf file.
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
When I boot up the machine (it is a VM actually), IPv6 is disabled. But when I create a new namespace, IPv6 is enabled by default. I added the following line to /etc/sysctl.conf file, but still IPv6 is enabled.
net.core.devconf_inherit_init_net=1
I tried with setting the value to 2 and 3 too. The default is 0. But IPv6 was still enabled inside a newly created namespace.
How do I disable IPv6 by default when a new namespace is created?
My requirement is to have IPv6 disabled globally and in newly created namespaces. If the user wants to enable IPv6 in a specific namespace, he/she can do so with the following command
sudo nsenter --net=/var/run/netns/<namespace name> sysctl -w net.ipv6.all.conf.disable_ipv6=0
Dheeraj