You are not logged in.

#1 2016-02-13 03:38:25

Registered: 2014-09-08
Posts: 5

[SOLVED] Problem Enabling Persistent IP Forwarding

I'm trying to configure my workstation to share its internet connection. My setup works just fine provided that I set the kernel variable "net.ipv4.ip_forward" to "1" after every reboot. I've added the line "net.ipv4.ip_forward = 1" to /etc/sysctl.conf. Unfortunately this doesn't work as expected and I see something like this after a reboot

someguy@aPC:~$ cat /etc/sysctl.conf
net.ipv4.ip_forward = 1
someguy@aPC:~$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

Can anyone think of a reason why the settings in /etc/sysctl.conf aren't being respected? Also, in troubleshooting this it would be helpful to know what program is responsible for reading /etc/sysctl.conf and setting kernel variables at runtime (the kernel perhaps?).

Any assistance would be greatly appreciated (but not compensated).

Last edited by tac-shell (2016-02-13 04:48:00)


#2 2016-02-13 04:01:40

From: .nz
Registered: 2009-05-09
Posts: 30,002

Re: [SOLVED] Problem Enabling Persistent IP Forwarding

The highlighted section sort of gives it away... … figuration

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438


#3 2016-02-13 04:59:34

Registered: 2014-09-08
Posts: 5

Re: [SOLVED] Problem Enabling Persistent IP Forwarding

Thanks for the prompt reply.

Following the wiki link you posted, I moved /etc/sysctl.conf to /etc/sysctl.d/ipv4_forwarding.conf and "net.ipv4.ip_forwarding" now equals "1" after  booting. I suppose this is an example of why reading release notes is a good idea; it saves you from making mistakes when the default behavior of the system changes.

Also, judging from the sysctl wiki page, the answer to my second question is that systemd sets kernel variables based on the configuration files in /etc/sysctl.d.


Board footer

Powered by FluxBB