whatis sysctl

sysctl

Also known as: kernel tunables, /proc/sys

The interface for reading and changing kernel runtime parameters, such as networking and memory settings, under /proc/sys.

What Is sysctl in Linux?

Each sysctl key maps to a file in /proc/sys/, so net.ipv4.ip_forward is /proc/sys/net/ipv4/ip_forward. sysctl -w changes a value immediately but only until reboot.

Persistent settings go in a file under /etc/sysctl.d/ and are applied with sysctl --system. Common tweaks include enabling IP forwarding for routers and VPNs and adjusting vm.swappiness.

Example

echo 'net.ipv4.ip_forward = 1' | sudo tee /etc/sysctl.d/99-forward.conf
sudo sysctl --system