All of lore.kernel.org
 help / color / mirror / Atom feed
* port forwarding through localhost
@ 2007-01-26 21:56 Andy B.
  2007-01-26 22:18 ` Pascal Hambourg
  0 siblings, 1 reply; 8+ messages in thread
From: Andy B. @ 2007-01-26 21:56 UTC (permalink / raw)
  To: netfilter

I have a port forwarding issue with localhost.

Here is the deal:

Webserver that uses many many mySQL connections to 127.0.0.1 (Port 3306).

Now I would like to put the mySQL server onto a dedicated machine without
changing the "127.0.0.1" setting on a few hundred websites.

The new mySQL Server listens on 10.0.0.100:3306

My first guess was the following ruleset on the webserver:

iptables -t nat -A PREROUTING -p tcp -i lo --dport 3306 -j DNAT --to
10.0.0.100

Then I tried to telnet 127.0.0.1 3306, which failed immediately


I figured out the prerouting is no good for localhost and changed it into:

iptables -t nat -A OUTPUT -o lo -p tcp --dport 3306 -j DNAT --to
10.0.0.100:3306

telnet 127.0.0.1 3306 seems to do something, but not what I expected:

$ telnet 127.0.0.1 3333
Trying 127.0.0.1...

<sleeping...... sleeping......>

Timeout eventually.


A few more informations on the webserver:

- eth0 = public IP (not needed here)
- eth1 = 10.0.0.99
- lo = 127.0.0.1

Dedicated MySQL Server:

- eth0 = public IP (not needed here)
- eth1 = 10.0.0.100
- lo = 127.0.0.1


What am I missing or doing wrong?

Thanks a lot,

Andy



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-01-31  9:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26 21:56 port forwarding through localhost Andy B.
2007-01-26 22:18 ` Pascal Hambourg
2007-01-26 22:29   ` Andy B.
2007-01-26 22:50     ` Pascal Hambourg
2007-01-26 22:55       ` Andy B.
2007-01-26 23:09         ` Jan Engelhardt
2007-01-30 19:54         ` Michael P. Brininstool
2007-01-31  9:09           ` Andy B.

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.