Forwarding MySQL connection with iptables and differents network interfaces
Posted
by
Emilio Nicolás
on Server Fault
See other posts from Server Fault
or by Emilio Nicolás
Published on 2012-06-02T18:31:14Z
Indexed on
2012/06/03
4:43 UTC
Read the original article
Hit count: 555
I have a PC with Ubuntu as a router. It has a 3G connection with a public IP to the Internet, and there is a private wireless subnet. So it has two active interfaces:
- ppp0: public IP (WAN)
- wlan0: private IP (LAN)
With iptables I wannt to forward every MySQL connection (port 3306) to a local machine (10.42.43.10) of the subnet.
I type these iptables commands:
iptables -A PREROUTING -t nat -i ppp0 -p tcp --dport 3306 -j DNAT --to 10.42.43.10:3306
iptables -A FORWARD -p tcp -i ppp0 -o wlan0 -d 10.42.43.10 --dport 3306 -j ACCEPT
But it doesn't work. telnet publicip 3306 fails :-(
Any help will be appreciated. Thanks!
© Server Fault or respective owner