Skip to content

sysctl Setting Not Applied After Reboot: How to Make It Permanent

Updated 1 min read

Updated: 22 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.

Related services

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.

Was this answer helpful?

Still stuck? Open a ticket