sysctl

From NetBSD Wiki

Jump to: navigation, search
This article is a stub. You can help by editing it.

With sysctl(8) you can get or change the current value of kernel variables. These variables are dynamic and different from the static ones in options(4), although there is some minor overlap. In those cases the (static) kernel config variable dictates the default value, which may be overridden with sysctl.

Example:

sysctl -a

lists all current values and

sysctl net.inet.ip.forwarding

shows the current value of the variable net.inet.ip.forwarding (allow IP packet forwarding if set to 1), and with

sysctl -w net.inet.ip.forwarding=1

you can set it to 1 (-w for "write")

If you want to make your changes persistent across reboots, you can add a line to /etc/sysctl.conf:

net.inet.ip.forwarding=1

This gets automatically executed at boot time.

See also

(there are many more *ctl commands, but others than those above have different commandline syntax and do completely different things from getting/setting variables)

View source code (Please report any bugs or suggestions here).

Personal tools