Thursday, August 16, 2012

Simple Linux Router setup

Assume you have machine pre-install with Centos 5.x and 2 NIC cards.

  1. Configure 2 NIC   by exec 'system-config-network'.
             eth0 : 192.168.1.1
             netmask: 255.255.255.0
          
             eth1 : static IP  / DHCP from ISP 


        2.   configure the iptables to enable IP Masquerading and share your internet connection.

             iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
             /etc/init.d/iptables save

        3.   Enable ip forward

               vi /etc/rc.local
               echo 1 > /proc/sys/net/ipv4/ip_forward