We have a Linux machine (Redhat 6)
When we print all parameters from /etc/sysctl.conf
we see only ~20
but when we perform sysctl -a
we see more than 200.
So from where sysctl -a
print all these parameters ?
Or for example when we do
sysctl -w variable=value
how to know where the variable should be saved?
How to know each parameters if it is dynamic or static?
Best Answer
Sysctl settings are stored in the kernel. These settings influence kernel behavior; basically, they're variables of the kernel which programs running on the system can read and write.
When the kernel boots, each sysctl setting has a default value. This value can be changed at any time by a program such as the
sysctl
command, or, under Linux, by writing to the corresponding file under/proc/sys
.The file
/etc/sysctl.conf
does not determine the value of the settings at run time. It's only used at boot time, to change some settings from the default value compiled into the kernel. If you've made some changes to/etc/sysctl.conf
, you can apply them as a whole by restarting the sysctl “service” — the sysctl service doesn't correspond to a running process, it's a pseudo-service that just loads the settings into the kernel when it starts.If you want to change a setting so that the value is preserved across reboots, add it to
/etc/sysctl.conf
. To apply a setting temporarily or to try it out, usesysctl
orecho … >/proc/sys/…
.