Sunday, September 11, 2011

Setting up a Linux server as Gateway


Configuring Linux as an internet gateway using iptables

Edit sysctl.conf file by doing
admin@suresh$ vi /etc/sysctl.conf

now turn on IP forwarding in sysctl.conf config file by setting the value to 1

the ip tables command for nat masquerade(masquerade mean All computers appear to have the same IP)

admin@suresh$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADEadmin@suresh$ iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
check the iptables effect by
admin@suresh$ iptables-save
(note :  iptables-save inside the file /etc/sysconfig/iptables )