Updated: 28 September 2026 · Applies to: procps-ng sysctl and systemd-sysctl on AlmaLinux and Rocky Linux 9 and 10, RHEL 9 and 10, Ubuntu 24.04 and 26.04, Debian 13
Kernel parameters control things such as IP forwarding, network buffer sizes, swap behaviour and file limits. sysctl reads and changes them while the system runs, and files in /etc/sysctl.d/ make changes permanent.
1. Read a value
sysctl net.ipv4.ip_forward sysctl -a | grep swappiness # search all parameters
Each parameter is also a file under /proc/sys/, with dots as slashes: cat /proc/sys/net/ipv4/ip_forward.
2. Change it now (until reboot)
sysctl -w net.ipv4.ip_forward=1
The change applies at once and is lost at the next reboot. Use this to test a value first.
3. Make it permanent
- Create a file in
/etc/sysctl.d/, named after its purpose and ending in.conf:echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/90-ip-forward.conf
- Load all settings files now:
sysctl --system
The output lists each file as it is read, so you can see that yours was applied. - Check:
sysctl net.ipv4.ip_forward
Files are read in name order from /usr/lib/sysctl.d/, /run/sysctl.d/ and /etc/sysctl.d/, and a later value wins, so a 90- prefix makes your setting override the defaults. A file in /etc/sysctl.d/ with the same name as one in /usr/lib/sysctl.d/ replaces it completely. /etc/sysctl.conf is still read (through the link /etc/sysctl.d/99-sysctl.conf), but separate files are easier to manage.
Parameters people often change
net.ipv4.ip_forward = 1: route traffic between interfaces (VPN servers, routers, containers).vm.swappiness = 10: swap less.net.core.somaxconn = 4096: longer queue for incoming connections on busy web servers.fs.inotify.max_user_watches = 524288: more file watches for development tools and sync clients.
Change only what you understand and can measure. Wrong network values can make a server slower or unreachable.
Common problems
- "cannot stat /proc/sys/...: No such file or directory": a typo, or the module that provides the parameter is not loaded yet (for example
br_netfilterfornet.bridge.*). Load the module at boot; see kernel module configuration. - The value is back to the default after reboot: another file with a later name sets it too. Search with
grep -r somaxconn /etc/sysctl.d /usr/lib/sysctl.d /etc/sysctl.conf. - In a container or on some VPS types, many parameters belong to the host and cannot be changed.
Official documentation: sysctl manual page and sysctl.d.
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
