Monday, September 23, 2013

Symmetric NAT configure by Linux IPTables.




Symmetric NAT configure by Linux IPTables.



Hardware: PC with double LAN card.
OS: Ubuntu 8.04

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



#vi symmetricNAT.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 symmetricNAT.sh                                    // Provide executable permission.


Run Firewall Scripts:

# sh symmetricNAT.sh

It will work for Symmetric NAT GW.

No comments:

Post a Comment