[CentOS] sysctl -p at startup?

Leon Fauster leonfauster at googlemail.com
Wed Jan 9 16:34:31 UTC 2013

Am 09.01.2013 um 17:13 schrieb Emmett Culley:
> On 01/08/2013 12:39 PM, Leon Fauster wrote:
>> for sysctl configs i suggest the /etc/sysctl.d directory (create it if ...)
>> for example:
>> $ cat /etc/sysctl.d/vpn.conf
>> net.ipv4.ip_forward = 1
> There was no /etc/sysctl.d directory, so I created one and added a file with
> sysctl -p on the first line, still no change to my requested settings after
> a reboot.  So I changed the file to look like:
> #!/bin/bash
> sysctl -p
> and made it executable (just in case :-) and of course that didn't work either.
> I've noted that there was a bug reported for RHEL5 that stated this would be fixed in 6.  
> I guess that didn't happen.  And I am not even certain that it isn't working as expected.
> In the mean time I will stick to using /etc/rc.local.

The files (/etc/sysctl.d/*.conf) must have the format of 

net.ipv4.ip_forward = 1

like /etc/sysctl.conf

That files (/etc/sysctl.d/*.conf) are read by the start 
script rc.sysinit (function apply_sysctl) after /etc/sysctl.conf
was read. 


More information about the CentOS mailing list