net.ipv4.ip_forward not peristent, even in /etc/sysctl.conf
3
votes
2
answers
4705
views
Currently i'm setting up a new Debian 11 Bullseye machine to act as a Wireguard gateway.
Everything as usual, and simple.
Unfortunately i am having a heavy issue regarding the IPV4 packet forwarding.
It's a well known fact, that i have to uncomment
#net.ipv4.ip_forward
in the /etc/sysctl.conf
file, to enable packet forwarding.
Unfortunately,even when it's uncommented, the setting is not being applied automatically after reboot.
I have to manually process the sysctl file using "sysctl -p" every time after reboot.
What's wrong here? There is also no further sysctl.conf in sysctl.conf.d which may override this setting.
I have also tried on a fresh Debian 11 system, with the same issue.
root@wireguard:~# /sbin/sysctl --system
* Applying /etc/sysctl.d/1-sysctl.conf ...
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
* Applying /usr/lib/sysctl.d/50-pid-max.conf ...
kernel.pid_max = 4194304
* Applying /usr/lib/sysctl.d/protect-links.conf ...
fs.protected_fifos = 1
fs.protected_hardlinks = 1
fs.protected_regular = 2
fs.protected_symlinks = 1
* Applying /etc/sysctl.conf ...
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
After reboot:
root@wireguard:~# cat /proc/sys/net/ipv4/ip_forward
0
root@wireguard:~# cat /proc/sys/net/ipv6/conf/all/forwarding
1
I hope someone can help me, it looks like, it's being partially applied only, i don't know if it has something to do with the IPv6 setting. Everything apart from the sysctl.conf and the Wireguard install is set to default.
Asked by Fabian Druschke
(305 rep)
Sep 21, 2021, 08:38 PM
Last activity: Jan 22, 2025, 09:23 PM
Last activity: Jan 22, 2025, 09:23 PM