Skip to content

Instantly share code, notes, and snippets.

@luke10x
Created November 29, 2018 17:21
Show Gist options
  • Save luke10x/2c6827fa60900381e69310dcb9c97014 to your computer and use it in GitHub Desktop.
Save luke10x/2c6827fa60900381e69310dcb9c97014 to your computer and use it in GitHub Desktop.
### Flush and Delete Old Settings ...
iptables -X
iptables -F
iptables -t nat -F
### " ALL MYSQL TRAFFIC FROM Y, PORT (3306) TO Z PORT (3306) ...."
# iptables -t nat -A PREROUTING -p tcp -d db-host.com --dport 3306 -j DNAT --to-destination 192.168.5.1:4041
iptables -t nat -A OUTPUT -p tcp -d db-host.com --dport 3306 -j DNAT --to-destination 192.168.5.1:4041
#iptables -A FORWARD -p tcp -d db-host.com --dport 3306 -j ACCEPT
### "FORWARD PACKETS ON EH0 AND EH1 ...."
echo 1 > /proc/sys/net/ipv4/ip_forward
### "MASQUERADE ON EH0 FOR NAT ...."
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