Configuration·LPIC-2
sysctl, and what survives a reboot
Kernel tunables can be read and written two ways - through /proc/sys as files, or through sysctl as dotted names - and they are the same values. This guide shows both, changes one, puts it back, and is explicit about the fact that neither method persists on its own.
201: Linux Kernel Guide 5 of 29 Intermediate
- OSUbuntu 26.04 LTS
- Kernel7.0.0-30-generic
- systemd259
- Block devicesone 50 GB disk
- TimeAbout 12 min
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LPIC2-A01 | 192.168.0.78 | Ubuntu 26.04 LTS | Primary service host - BIND, Apache, Samba, Postfix. Topic 204 RAID runs on loop devices; this machine has no spare disk | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when a kernel setting has to change - routing, memory reclaim, open file limits - and especially when one that worked yesterday is gone after a reboot. This matters because the command that changes a tunable and the file that keeps it changed are two different things.
- reading one tunable two ways, as
net.ipv4.ip_forwardand as/proc/sys/net/ipv4/ip_forward - changing it at runtime with
sysctl -wand confirming it took by reading the proc file back - putting it back inside the same step, because IP forwarding is not a small thing to leave on
- seeing why neither
sysctl -wnor anechointo/proc/syssurvives a reboot - finding
/etc/sysctl.d/, where a setting goes when it has to be kept
Before you start
- kernel-modules-and-runtime-parameters
-
The same value, two spellings
-
Changing it, and putting it back
-
Where a setting goes to survive