How to enable IP Forwarding in Linux
If you are trying to setup a computer network where your internet gateway or the edge system is running Linux than to allow other computers on your network to connect to the internet you need to set-up IP forwarding on your gateway linux system.
By default the IP forwarding is not enabled on Linux, the reason being security, you don’t want others systems to communicate through you without explicit permission from you.
Enabling IP forwarding can be achieved by a single command
echo 1 > /proc/sys/net/ipv4/ip_forward
the above command with put a value of 1 in file /proc/sys/net/ipv4/ip_forward
1 means that IP forwarding is enabled. If you want to disable IP forwarding than echo 0 to the above file
If you want to keep the setting even after a reboot than you need to set the FORWARD_IPV4 variable in /etc/sysconfig/network file
/etc/sysconfig/network
FORWARD_IPV4=true