Skip to content

Instantly share code, notes, and snippets.

@joenorton8014
Created August 11, 2018 14:32
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 joenorton8014/cd2c195fda2fe6115a0bcc852841d047 to your computer and use it in GitHub Desktop.
Save joenorton8014/cd2c195fda2fe6115a0bcc852841d047 to your computer and use it in GitHub Desktop.
echo "IP forwarding state:"
sysctl net.ipv4.ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
echo "Current IP forwarding state is:"
sysctl net.ipv4.ip_forward
echo "Enabling nat: "
iptables -A FORWARD -o eth0 -i eth1 -s 192.168.56.0/24 -m conntrack --ctstate NEW -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment