Monday, September 23, 2013

Port Address Translation ++ configure by Linux IPTables.




Port Address Translation ++ configure by Linux IPTables.

Hardware: PC with double LAN card.
OS: Linux  Debian: 2.6.32-5-686


Interface:
eth0: Private IP block                                       //Configure eth0 with Private IP
eth1: Public IP                                                 // Configure eth1 with Public IP



#vi PATpp.sh                                                    //Firewall script

#!/bin/sh

echo "1" > /proc/sys/net/ipv4/ip_forward

/sbin/iptables --flush

/sbin/iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE --random

/sbin/iptables -A FORWARD -i eth1 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT

/sbin/iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT


Save and exit
#chmod +x PATpp.sh                                                // Provide executable permission.


Run Firewall Scripts:
# sh PATpp.sh



It will work for PAT++ GW.

No comments:

Post a Comment