[CentOS] sysctl -p at startup?

Wed Jan 9 17:08:43 UTC 2013
Emmett Culley <emmett at webengineer.com>

On 01/09/2013 08:34 AM, Leon Fauster wrote:
> 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
> e.g.
>
> 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.
>
>
> --
> LF
>
Yes, that is what I tried first.  I just made it executable after that failed as it was quicker to do that than to google or ask the list.

As for apply_sysctl...  That calls sysctl -e -p /etc/sysctl.conf. At least that is what I would expect.  However if it is getting called, the changes aren't sticking.

Emmett