How do I turn on IP forwarding on Linux?
Posted by on 2014-09-19 13:40:02:
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 FORWARD_IPV4=true #
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