FreeBSD 101 : Sysctl - Tweaking the kernel -

Sysctl offers us a way to change the kernel parameters on the fly to fit the requirements of different hardware, different programs, ...

Viewing the kernel parameters:

Below is the hierarchy of the "sysctl" parameters:

To be able to view the "tunable" kernel parameters, we could use the below command:

The kernel parameters form a hierarchy called an MIB (Management Information Base).

Each level in the MIB has a sublevel and so on.
The values of the sysctl parameters could have one of the below types:
  • string: a text.
  • integer: a whole number.
  • boolean : are either 1 or 0.
  • machine-specific: contain code that is only decipherable by another program.
Describing the kernel parameters:

To get an idea of the role of a specific kernel parameter, we could use the below command:


"" means Default congestion control algorithm.

Going down the "sysctl" hierarchy:

To be able to see the "net" parameters for example, we use:

We could go a level deeper using the below command:

And one more level down:

Changing a "sysctl" variable:

We could modify a "sysctl" variable using the below:

To be able to make it persist beyond a reboot, we would need to add our parameter to the "/etc/sysctl.conf" file.

Kernel environment:

These variable are loaded at boot-time. They are passed by the bootloader to the kernel.

To view them, we use the below command:

We could modify these environment variables in the"/boot/loader.conf" file.


Leave as a comment: