How to enable IP Forwarding in Debian

IP routing/forwarding is disabled per default in Debian.

For enabling on the fly, you only have to write “1″ in /proc/sys/net/ipv4/ip_forward or to set the kernel parameter net.ipv4.ip_forward to “1″.

Method #1:
echo 1 > /proc/sys/net/ipv4/ip_forward
Method #2:
sysctl -w net.ipv4.ip_forward=1

The actual setting can be checked as following:

debian:~# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1
debian:~# cat /proc/sys/net/ipv4/ip_forward

If you want permanent setting, the most common way is to add a line containing  “net.ipv4.ip_forward = 1″ to the file /etc/sysctl.conf

net.ipv4.ip_forward = 1

You can activate the changes made in the kernel parameter configuration file by running the command:

sysctl -p /etc/sysctl.conf

Perhaps there are some distribution specific scripts available in Debian, but i didn’t check it.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>