From mboxrd@z Thu Jan 1 00:00:00 1970 From: "adburne" Subject: NAT & MySQL Date: Tue, 25 Nov 2003 09:17:32 -0300 Sender: netfilter-admin@lists.netfilter.org Message-ID: <3FC3485C.000009.00204@adburne> Mime-Version: 1.0 Content-Type: Multipart/related; type="multipart/alternative"; boundary="------------Boundary-00=_85QWMY50000000000000" Return-path: Errors-To: netfilter-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Id: List-Unsubscribe: , List-Archive: To: netfilter@lists.netfilter.org --------------Boundary-00=_85QWMY50000000000000 Content-Type: Multipart/Alternative; boundary="------------Boundary-00=_85QWH890000000000000" --------------Boundary-00=_85QWH890000000000000 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Someone can make NAT with mysql? I've tried for a long time without make = it work.=0D =0D My natural language is spanish, sorry by mistakes writing in english.=0D =0D This is the situation:=0D =0D I've have a linux box as gateway between my lan and internet routing paqu= ets without problems, I need access from internet another linux box running apache and mysql on my private lan.=0D To do this work I try to use nat; with apache all works ok, but with mysq= l can't connect. I'll be looking on different network devices using tcpdump= to find what's wrong.=0D =0D This is what tcpdump show on device eth0 on my mysql server (inside the l= an) there is a petition from 200.10.10.1 (internet client) to 192.168.0.80 (mysql lan server), this reply with ack, but internet client don't =0D reply. Any clue? =3D)=0D =0D 200.10.10.1.56405 > 192.168.0.80.3306: S 2205542765:2205542765(0) win 584= 0 (DF)=0D 192.168.0.80.3306 > 200.10.10.1.56405: S 2497023396:2497023396(0) ack 2205542766=0D win 5792 (DF= )=0D 200.10.10.1.56405 > 192.168.0.80.3306: R 2205542766:2205542766(0) win 0 (= DF)=0D 200.10.10.1.56405 > 192.168.0.80.3306: S 2205542765:2205542765(0) win 584= 0 (DF)=0D 192.168.0.80.3306 > 200.10.10.1.56405: S 2503023731:2503023731(0) ack 2205542766=0D win 5792 (DF= )=0D 200.10.10.1.56405 > 192.168.0.80.3306: R 2205542766:2205542766(0) win 0 (= DF)=0D =0D =0D The forward rules on the gateway are:=0D =0D # "Accept forward all connections to port 3306 on ppp0"=0D iptables -A FORWARD -p tcp -i ppp0 --dport 3306 -o eth0 -j ACCEPT=0D # "All stablished connections are ok"=0D iptables -A FORWARD -i ppp0 -o eth0 -m state --state ESTABLISHED,RELATED = -j ACCEPT=0D # "All connection from inside to outside are accepted"=0D iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT=0D # "Rest go away"=0D iptables -A FORWARD -j REJECT=0D =0D NAT rule:=0D iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 3306 -j DNAT --to 19= 2 168.0.80 -s 200.10.10.1=0D =0D If someone can make the light turn on, thanks!!!!=0D =0D Alejandro --------------Boundary-00=_85QWH890000000000000 Content-Type: Text/HTML; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Someone can make NAT with mysql? I've tried for a long time without = make it work.
 
My natural language is spanish, sorry by mistakes writing in english= =2E
 
This is the situation:
 
I've have a linux box as gateway between my lan and internet routing= paquets without problems, I need access from internet another linux box = running apache and mysql on my private lan.
To do this work I try to use nat; with apache all works ok, but with= mysql can't connect. I'll be looking on different network devices using = tcpdump to find what's wrong.
 
This is what tcpdump show on device eth0 on my mysql server (inside = the lan), there is a petition from 200.10.10.1 (internet client) to 192.1= 68.0.80 (mysql lan server), this reply with ack, but internet client= don't
reply. Any clue? =3D)
 
200.10.10.1.56405 > 192.168.0.80.3306: S 2205542765:2205542765(0)= win 5840 <mss
1412,sackOK,timestamp 620645629 0,nop,wscale 0> (= DF)
192.168.0.80.3306 > 200.10.10.1.56405: S 2497023396:2497023396(= 0) ack 2205542766
 win 5792 <mss 1460,sackOK,timestamp 9576465= 8 620645629,nop,wscale 0> (DF)
200.10.10.1.56405 > 192.168.0.80.= 3306: R 2205542766:2205542766(0) win 0 (DF)
200.10.10.1.56405 > 192= =2E168.0.80.3306: S 2205542765:2205542765(0) win 5840 <mss
1412,sac= kOK,timestamp 620648701 0,nop,wscale 0> (DF)
192.168.0.80.3306 >= 200.10.10.1.56405: S 2503023731:2503023731(0) ack 2205542766
 wi= n 5792 <mss 1460,sackOK,timestamp 95765258 620648701,nop,wscale 0> = (DF)
200.10.10.1.56405 > 192.168.0.80.3306: R 2205542766:2205542766= (0) win 0 (DF)
 
The forward rules on the gateway are:
 
# "Accept forward all connections to port 3306 on ppp0"
ipta= bles -A FORWARD -p tcp -i ppp0 --dport 3306 -o eth0 -j ACCEPT
# "All stablished connections are ok"
iptables -A FORWA= RD -i ppp0 -o eth0 -m state --state ESTABLISHED,RELATED -j= ACCEPT
# "All connection from inside to outside are accepted"iptables -A FORWARD -i eth0 -o ppp0 -j ACCEPT
# "Rest go away"
iptables -A FORWARD -j REJECT
 
NAT rule:
iptables -t nat -A PREROUTING -p tcp -i ppp0 --dport 3306 -j DNAT --= to 192.168.0.80 -s 200.10.10.1
 
If someone can make the light turn on, thanks!!!!
 
Alejandro
 
______________________= ___________________________________________
3D""  IncrediMail = - El E-mail ha evolucionado finalmente - Haga clic aqu=ED
<= /SPAN> --------------Boundary-00=_85QWH890000000000000-- --------------Boundary-00=_85QWMY50000000000000 Content-Type: image/gif; name="IMSTP.gif" Content-Transfer-Encoding: base64 Content-ID: <0E1EA367-1F3C-11D8-B817-00805F579555> R0lGODlhFAAPALMIAP9gAM9gAM8vAM9gL/+QL5AvAGAvAP9gL////wAAAAAAAAAAAAAAAAAAAAAA AAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJFAAIACwAAAAAFAAPAAAEVRDJSaudJuudrxlEKI6B URlCUYyjKpgYAKSgOBSCDEuGDKgrAtC3Q/R+hkPJEDgYCjpKr5A8WK9OaPFZwHoPqm3366VKyeRt E30tVVRscMHDqV/u+AgAIfkEBWQACAAsAAAAABQADwAABBIQyUmrvTjrzbv/YCiOZGmeaAQAIfkE CRQACAAsAgABABAADQAABEoQIUOrpXIOwrsPxiQUheeRAgUA49YNhbCqK1kS9grQhXGAhsDBUJgZ AL2Dcqkk7ogFpvRAokSn0p4PO6UIuUsQggSmFjKXdAgRAQAh+QQFCgAIACwAAAAAFAAPAAAEEhDJ Sau9OOvNu/9gKI5kaZ5oBAAh+QQJFAAIACwCAAEAEAANAAAEShAhQ6ulcg7Cuw/GJBSF55ECBQDj 1g2FsKorWRL2CtCFcYCGwMFQmBkAvYNyqSTuiAWm9ECiRKfSng87pQi5SxCCBKYWMpd0CBEBACH5 BAVkAAgALAAAAAAUAA8AAAQSEMlJq7046827/2AojmRpnmgEADs= --------------Boundary-00=_85QWMY50000000000000--