- Sysctl
Sysctl is an interface for examining and dynamically changing parameters in a
BSD Unix (orLinux )operating system kernel. Generally, these parameters (identified as objects in aManagement Information Base ) describe tunable limits such as the size of a shared memory segment, the number of threads the operating system will use as anNFS client, or the maximum number of processes on the system; or describe, enable or disable behaviors such as IP forwarding, security restrictions on thesuperuser (the "securelevel"), or debugging output.Generally, a
system call or system call wrapper is provided for use by programs, as well as an administrative program and a configuration file (for setting the tunable parameters when the system boots).This feature appeared in the "4.4BSD" version of Unix and is also used in the Linux kernel. It has the advantage over hardcoded constants that changes to the parameters can be made dynamically without recompiling the kernel.
Examples
When IP forwarding is enabled, the operating system kernel will act as a
router . For the Linux kernel, the parameter net.ipv4.ip_forward can be set to 1 to enable this behavior. InFreeBSD ,NetBSD andOpenBSD the parameter is net.inet.ip.forwarding.In most systems, the command sysctl -w "parameter"=1 will enable the desired behavior. This will persist until the next reboot. If the behavior should be enabled whenever the system boots, the line "parameter"=1 can be added to the file /etc/sysctl.conf. Additionally, some sysctl variables cannot be modified after the system is booted, these variables (depending on the variable and the version and flavor of BSD) need to either be set statically in the kernel at compile time or set in /boot/loader.conf.
The proc filesystem
Under the Linux kernel, the
proc filesystem also provides an interface to the sysctl parameters. For example, the parameter net.ipv4.ip_forward corresponds with the file /proc/sys/net/ipv4/ip_forward. Reading or changing this file is equivalent to changing the parameter using the sysctl command.External links
* [http://www.openbsd.org/cgi-bin/man.cgi?query=sysctl http://www.openbsd.org/cgi-bin/man.cgi?query=sysctl(3) man page] via
OpenBSD
* [http://sysctl.enderunix.org http://sysctl.enderunix.org ]
* [http://lwn.net/Articles/204935/ Removal of Sysctl from 2.6.19.x]
Wikimedia Foundation. 2010.