Created
April 15, 2014 13:32
-
-
Save xandout/10732969 to your computer and use it in GitHub Desktop.
Linux NAT Quick Config
This file contains 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
echo 1 > /proc/sys/net/ipv4/ip_forward | |
#Assuming eth0 is connected to the Internet or other network and eth1 is connected to a private network | |
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |
iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT | |
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment