sysctl.conf - persistent parameter settings ?

Latest response

I am having problems making my kernel parameters persistent across re-boots.

In my case the parameter "net.ipv4.ip_forward" is set to "1" and I would like it to be set to "0".

Updated the "/etc/sysctl.conf" with the line "net.ipv4.ip_forward = 0".

Ran "sysctl -p".
Confirmed that the "1" had changed to "0".


And "net.ipv4.ip_forward" had been set back to "1".

There are several items I would like to know:
-) Where is the "1" setting coming from ?
-) From research (Googly) it seems to indicate that running "sysctl -p" / "sysctl.conf" is the correct way to go, did I miss something?
-) Does "sysctl -p" store the value elsewhere?

RHEL 7.3 Maipo
Attached are screen prints of my activity.


Did you check the files in /etc/sysctl.d/ ? New in RHEL 7 - at boot time, sysctl now reads /etc/sysctl.conf and /etc/sysctl.d/* (in sequential order). If a parameter is set in multiple files, the last setting wins, so your change to /etc/sysctl.conf may have been overridden by /etc/sysctl.d/99-sysctl.conf (or another file in that directory).

Also, check the 'sysctl' man page; 'sysctl -p' reads /etc/sysctl.conf but does not read all of /etc/sysctl.d/* (so your command-line invocation did not mimic boot-time behavior). 'sysctl --system' parses all config files in the same manner as the boot-time process.

Contents of /etc/sysctl.d/99-sysctl.conf shouldn't (technically) override /etc/sysctl.conf - by design, the former links to the latter:

$ readlink -f /etc/sysctl.d/99-sysctl.conf
$ rpm -qVf /etc/sysctl.d/99-sysctl.conf
.......T.    /etc/inittab
S.5....T.  c /etc/sysctl.conf

Yes, the /etc/sysctl.d/99-sysctl.conf is linked to /etc/sysctl.conf. In my attachment I had verified that both files had set "net.ipv4.ip_forward" to "0" in "/etc/sysctl.conf" via grep (I did not check linkage since these two "files" did not appear to be the source of my problem). I also verified the file change persistent across the re-boot.

After re-booting and when I run "sysctl -a" the "ip_forward" value has been set back to "1". It is also set to "1" in the file "/proc/sys/net/ipv4/ip_forward".

If I manually run "sysctl -p" the settings in the "sysctl.conf" file are applied for the session, till re-boot.

I notice that if I run: rpm -qVf /etc/sysctl.d/99-sysctl.conf my results do not reflect "/etc/inittab".

My suspicion is that my issue is a runlevel script type of issue that would run the "sysctl -p" command or the value was overwritten....

TIA Scott M

Identify the tuned active profile and check if the value is specified in tuned active profile. If yes, then it needs to be removed or modified. The tuned profile setting override /etc/sysctl.conf setting.

I also have same problem. But seems tuned is not causing this problem. I stopped/disabled tuned still, net.ipv4.ip_forward got enabled.


Do you have any bridge network (like in Docker container, for example)? Typically, containers force this parameter too.


Dusan Baljevic (amateur radio VK2COT)