1

By default, when I create a network namespace, I get:

/proc/sys/net/ipv6/conf/all/forwarding=0 

Even if it is 1 in my root network namespace or in /etc/sysctl.conf. I was wondering where network namespaces get the default config and how to change that. I'd like to have that set to 1 so that new network namespaces get that config by default.

2 Answers 2

2

I thikn I found the answer. In general, network namespaces inherit the parameters of the root namespace. This is controlled by devconf-inherit-init-net settings as explained here: https://www.kernel.org/doc/html/latest/admin-guide/sysctl/net.html#devconf-inherit-init-net

By default all ipv4 parameters are inherited but not ipv6

1
  • Nice find. The default does make some sense. Most of the time containers will configure IPv6 very differently to the host, and starting with the default configuration is reasonable in this scenario. By contrast inheriting IPv4 configuration has been done for so long that most everyone expects it to happen, and changing that to not inherit would confuse people and break existing applications in unforeseen ways. And Linus always says to never break userspace.... Commented Sep 28, 2021 at 10:41
0

you can set the default by giving it a value of 1 by issuing

 # to confirm you are starting with value 0 cat /proc/sys/net/ipv6/conf/default/forwarding 0 # now set a value of 1 echo 1 > /proc/sys/net/ipv6/conf/default/forwarding # to confirm your new value issue cat /proc/sys/net/ipv6/conf/default/forwarding 1 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.