How do I enable IP forwarding (ip_forwarding) in Debian Lenny / Etch?

Well first check if it is not yet enabled, you can do that by:

 

  • cat /proc/sys/net/ipv4/ip_forward

If the result is 0 it is in fact disabled.
To enable it you can do one of the folowing:

  • sysctl -w net.ipv4.ip_forward=1
  • echo 1 > /proc/sys/net/ipv4/ip_forward

Now it should be enabled. To enable it permanently which is most likely what you want you can edit /etc/sysctl.conf with your favourite editor and add the following line:

  • net.ipv4.ip_forward = 1

and right after you added this, issue the following command:

  • sysctl -p /etc/sysctl.conf

done!

 

If you still run on Debian Sarge, you can edit the /etc/network/options file and change ip_forward=no to ip_forward=yes

You cannot comment on this entry