Updated: 11 October 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9

A kernel parameter set with sysctl can be lost at reboot for two reasons: it was only set at runtime, or another tool sets it again later in the boot. These steps apply to Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9.

Make a setting permanent

  1. Put it in its own file in /etc/sysctl.d/, for example /etc/sysctl.d/99-custom.conf: net.ipv4.conf.all.forwarding = 0
  2. Load all files now: sysctl --system.
  3. Check the value: sysctl net.ipv4.conf.all.forwarding.

Files are read in name order, and a later file wins. The 99- prefix makes yours load last.

If it still changes after reboot

  • tuned (AlmaLinux/Rocky): a tuned profile can set sysctl values after boot. See the active profile with tuned-adm active. Create a custom profile in /etc/tuned/myprofile/tuned.conf with include=virtual-guest (your current profile) and a [sysctl] section, then tuned-adm profile myprofile.
  • Docker, libvirt or VPN software turn IP forwarding on when they start. Stop them from managing it, or accept the change.
  • Find which files set a value: grep -r forwarding /etc/sysctl.conf /etc/sysctl.d /usr/lib/sysctl.d /run/sysctl.d.

Ucartz services for this topic

Was this answer helpful? 0 Users Found This Useful (0 Votes)