Skip to content

Instantly share code, notes, and snippets.

@vaporup
Last active August 12, 2017 19:52
Show Gist options
  • Save vaporup/94809a9804efbe633094bd05f3d296a8 to your computer and use it in GitHub Desktop.
Save vaporup/94809a9804efbe633094bd05f3d296a8 to your computer and use it in GitHub Desktop.
route ports to another host via iptables #iptables
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p TCP --dport 1235 -j DNAT --to 172.30.16.107:1235
iptables -t nat -A PREROUTING -p TCP --dport 8180 -j DNAT --to 172.30.16.107:49502
iptables -t nat -A POSTROUTING -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment