How to Enable IP Forwarding
Posted on February 4th, 2008 by hengdu
One Linux computer box could be as a router if it has more than one NIC. Howerver, it would not forward packages as normal router does. Here is a simple example: Host1—Host2—Host3. Host2 will be router to let Host1 connects to Host3. You may find out Host1 cannot PING Host3. To solve it, there are two ways to enable ip_forward on Host2.
1. Simple but will lost at next reboot
echo 1 > /proc/sys/net/ipv4/ip_forward
2. Change Configuration at next reboot
“vi /etc/sysctl.conf ” to change following configuration:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
Of course, the best way to enable IP forwarding is to configure iptables, which will be more secured.
Discussion Area - Leave a Comment