• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Make IP Forwarding permanent?  (Read 2236 times)
theRealBigP
Newbie
*

Karma: 0
Posts: 22


View Profile
« on: September 10, 2010, 04:41:58 AM »

I setup OpenVPN on my plug a while back, and I forgot that I had enabled IP forwarding on it so that my client machine could see the subnet behind my OpenVPN server. It took me a while to figure out that the reason this no longer worked was because the plug had been rebooted and had therefore reverted back to the original setting of ip_forward=0. Is there some way to make this setting permanent so that it sticks across reboots? Thanks.
Logged

cjm
Jr. Member
**

Karma: 6
Posts: 69


View Profile
« Reply #1 on: September 10, 2010, 12:02:49 PM »

See if you have a file called something like /etc/sysctl.conf and add the entry

net.ipv4.ip_forward=1

If the file doesn't exist, locate a startup script (e.g. /etc/rc.local, this depends on your distribution) and add the following line:

echo 1 >/proc/sys/net/ipv4/ip_forward

Thanks,
--Christian
Logged

birdman
Sr. Member
****

Karma: 4
Posts: 443


View Profile WWW
« Reply #2 on: September 10, 2010, 02:00:28 PM »

On Ubuntu and Debian you should put a file with the bits you want to add into the /etc/sysctl.d/ directory (see the README file there).  This means you are adding your own file, rather than editing a system one which an OS update may wish to change later.

And you can set forwarding per-interface, rather than globally.  Probably doesn't matter on the Plug, but as a principle it's best to only switch on what you need.

I have an /etc/sysctl.d/60-My-eth-routing.conf file with:
Quote
net.ipv4.conf.eth0.forwarding=1
net.ipv4.conf.wlan0.forwarding=1
Logged

theRealBigP
Newbie
*

Karma: 0
Posts: 22


View Profile
« Reply #3 on: September 13, 2010, 04:29:30 AM »

Thanks guys. I ended up going with birdman's suggestion, as that seemed more 'userland' than cjm's approach. Sure enough, after a reboot I checked the contents of /proc/sys/net/ipv4/ip_forward and it had 1 in there rather than 0, so looks like it's going to stick now.
Logged

Pages: [1]
Print
Jump to: