Skip to content

Instantly share code, notes, and snippets.

@eresende
Created October 21, 2015 08:42
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save eresende/c4dbccf329dd0409e49e to your computer and use it in GitHub Desktop.
Save eresende/c4dbccf329dd0409e49e to your computer and use it in GitHub Desktop.
Forward MySQL port to another IP with IPTABLES
iptables -t nat -A PREROUTING -p tcp --dport 3306 -j DNAT --to 10.0.4.172:3306
iptables -A FORWARD -p tcp -d 10.0.4.172 --dport 3306 -j ACCEPT
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