IP forwarding is a process of forwarding IP packets received on one network interface to another network interface. This means that the host that is doing the IP forwarding is neither the source of data nor the sink. IP forwarding must be enabled on hosts that act as routers. Such a host is essentially connected to two or more networks. It receives IP packets from one network, analyzes the packets to determine to which network the packet should be forwarded using a routing mechanism, and then sends the packet to the destination using another network interface.
By default the IP forwarding is not enabled on Linux, the reason being security, you don’t want other 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. For example:
# vi /etc/sysconfig/network FORWARD_IPV4=true