Linux Router – IP Forwarding

Linux Router – IP Forwarding

If you want to use Linux for routing, you need to activate IP forwarding. After you’ve configured your kernel, you have to do this:

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

Of course, you want this to happen when you boot. You can do this anywhere in your boot scripts, but there are already some facilities to handle it.

If you have sysctl, which is how I configured this for Debian, you can add this line to /etc/sysctl.conf

net.ipv4.ip_forward = 1

With Redhat, you can edit /etc/sysconfig/network:


More information on Linux IP Masquerading can be found here.