Created
December 4, 2013 05:50
-
-
Save you21979/7782989 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
internal_ip='10.0.0.0/8' | |
external_ip='172.16.0.0/12' | |
iptables -F | |
iptables -t nat -F | |
iptables -P INPUT ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -A FORWARD -i eth0 -o eth1 -s $internal_ip -j ACCEPT | |
iptables -A FORWARD -i eth1 -o eth0 -s $external_ip -j ACCEPT | |
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT | |
iptables -P FORWARD DROP | |
iptables -t nat -A POSTROUTING -o eth1 -s $internal_ip -j MASQUERADE | |
iptables -t nat -A POSTROUTING -o eth0 -s $external_ip -j MASQUERADE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment