Skip to content

Instantly share code, notes, and snippets.

@ricventu
Created November 24, 2017 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricventu/688d1a9b43c65537c1df4fa9d2bae73b to your computer and use it in GitHub Desktop.
Save ricventu/688d1a9b43c65537c1df4fa9d2bae73b to your computer and use it in GitHub Desktop.
Ubuntu nat routing
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

iptables-save > /etc/network/iptables.rules

add in /etc/network/interface:

pre-up iptables-restore < /etc/network/iptables.rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment