/etc/sysctl.conf loaded even if not linked or overwritten in /etc/sysctl.d/
Issue
- The documentation available in the man of
sysctl.d
states:
All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in.
-
It can be understood that "All" would also include
/etc/sysctl.conf
, meaning its lexicographic value is first asserted and all other files with greater value overwrite it. The order of directories only takes precedence if two files have the same name. -
But, if we remove the symbolic link to
/etc/sysctl.conf
or create a file with a greater lexicographic value, we have this result:
- Remove of symbolic link:
1. set 'net.ipv6.conf.all.disable_ipv6 = 1' in /etc/sysctl.conf
2. remove symbolic link /etc/sysctl.d/99-sysctl.conf
3. `sysctl -p` gives output: net.ipv6.conf.all.disable_ipv6 = 1
And
- File with greater value:
1. set 'net.ipv6.conf.all.disable_ipv6 = 1' in /etc/sysctl.conf
2. create file /etc/sysctl.conf/99-zysctl.conf with content 'net.ipv6.conf.all.disable_ipv6 = 0'
3. `sysctl -p` gives output: net.ipv6.conf.all.disable_ipv6 = 1
Environment
RHEL 7
sysctl
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.