Thursday, November 5, 2009

How to configure linux machine as Router

Hi,
I have given very simple steps to configure Linux Machine as router. Here we aregoing to use NAT option in firewall to make that.

1.Two lan cards.
eth0 - Connected with internet ( Public )
eth1 - Local Area Network ( Private )

2. Enable ipv4 packet forwarding ( run as a administrator or user with sudo power )

#echo "1" /proc/sys/net/ipv4/ip_forward
or
edit /etc/sysctl.conf and change 0 to 1 in net.ipv4.ip_forward
After that ran sysctl -p command to save that
#sysctl -p

3.Enable Iptables to handle NAT.

$/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

4.Save the Iptables rule
$/sbin/service iptables save

5.Check the iptable rule
$/sbin/iptables -t nat --list

Thats all.

No comments:

Post a Comment