Skip to content

Instantly share code, notes, and snippets.

@ibejohn818
Created April 5, 2015 17:28
Show Gist options
  • Save ibejohn818/507fade3aa2b7f4dc218 to your computer and use it in GitHub Desktop.
Save ibejohn818/507fade3aa2b7f4dc218 to your computer and use it in GitHub Desktop.
Linux NAT'ing Steps
On NAT Host
1) enable IPv4 fowarding
/etc/sysctl.conf
2) Forward eth0 -> eth1 and vise-versa
-A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth1 -o eth0 -j ACCEPT
3) modify nat table to masquerade ( Rewrite ip packets )
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
On private nodes, set DNS to be public facing such as Google Public DNS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment