Skip to content

Instantly share code, notes, and snippets.

@moredure
Created March 13, 2020 18:50
Show Gist options
  • Select an option

  • Save moredure/8a55af8c698ab46447e1a4ba6dd78eeb to your computer and use it in GitHub Desktop.

Select an option

Save moredure/8a55af8c698ab46447e1a4ba6dd78eeb to your computer and use it in GitHub Desktop.
# Under bastion
route add default gw $PRIVATE_GW
# On Bastion
iptables -t nat -A POSTROUTING -p tcp -o $PUBLIC_IF -j SNAT --to-source $ANCHOR_IP
modprobe iptable_nat
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o $PUBLIC_IF -j MASQUERADE
iptables -A FORWARD -i $PRIVATE_IF -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment