GTKC Knowledgebase
A little bit of wisdom
How do I turn on IP forwarding on Linux?
Posted by  Admin on

Turn on IP forwarding in Linux IP.

To turn forwarding on temporarily, use the following command as root: (this will be disabled after a reboot)

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

Or to make it permanent add the following to /etc/sysctl.conf
net.ipv4.ip_forward = 1

In older versions of Redhat / CentOS you can edit /etc/sysconfig/network and enable it there:

# CRITICAL: Enable IP forwarding since it is disabled by default since
# Redhat Users: you may try changing the options in
# /etc/sysconfig/network from:
# FORWARD_IPV4=false
# to

You can also add echo "1" > /proc/sys/net/ipv4/ip_forward to /etc/rc.local although the above methods are preferred.

Tags: Networking , Linux

Return to home page: Home