Skip to content

Instantly share code, notes, and snippets.

@ruslanbogun
Last active September 20, 2017 08:39
Show Gist options
  • Save ruslanbogun/82093867b357864897f301d781688220 to your computer and use it in GitHub Desktop.
Save ruslanbogun/82093867b357864897f301d781688220 to your computer and use it in GitHub Desktop.
Amazon provides Amazon Linux AMIs that are configured to run as NAT instances. These AMIs include the string amzn-ami-vpc-nat in their names, so you can search for them in the Amazon EC2 console.
redirect from NAT to private net
sudo iptables -t nat -A PREROUTING -p tcp --dport 10234 -j DNAT --to-destination 10.0.1.234:22
sudo iptables -A POSTROUTING -t nat -s 10.0.1.0/24 -j MASQUERADE
sudo /etc/init.d/iptables save
list
sudo iptables -t nat -L -n -v
sudo iptables -t nat -v -L PREROUTING -n --line-number
delete
sudo iptables -t nat -D PREROUTING 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment