Created
April 5, 2015 12:16
-
-
Save wakwanza/3c08eedf6d40f60f4968 to your computer and use it in GitHub Desktop.
Create NAT route on GCE
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
#!/bin/bash | |
# | |
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" | |
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |
sudo iptables -A FORWARD --in-interface eth0 -j ACCEPT | |
sudo service iptables save | |
sudo sed -i 's/.*net.ipv4.ip_forward = 0*/net.ipv4.ip_forward = 1/' /etc/sysctl.conf | |
sudo sysctl -e -p /etc/sysctl.conf | |
sudo service iptables restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment