From: "Klemen Kecman" <klemen@sting.si>
To: netfilter@lists.netfilter.org
Subject: Re: iptables dnat to loopback
Date: Fri, 6 Aug 2004 13:54:50 +0200 [thread overview]
Message-ID: <002401c47bac$313d0350$6a02a8c0@klemen> (raw)
In-Reply-To: 1091792314.2256.18.camel@localhost
----- Original Message -----
From: "Damian Gatabria" <damian_g@speedy.com.ar>
To: "Lista Netfilter" <netfilter@lists.netfilter.org>
Sent: Friday, August 06, 2004 1:38 PM
Subject: iptables dnat to loopback
> Hello listers.
>
> I know this is probably not the proper place to ask
> a support question, but after a long googling
> session and asking in my regular lists i was unable to
> get an answer for what i think is a rather tough situation..
>
> So, flame me if you must, but here it is =oP
>
> I have a rather busy server box hosting several web
> sites in separate independent installation directories,
> which means several apache, mysql and tomcat installations
> running simultaneously, with each mysql instance binding
> a port in the loopback interface.
>
> Now, for a very specific reason, i need to provide someone
> with remote access to one of these mysql instances.
>
> It would be a real hassle to change mysql's config
> (and the webapps' working with it) so i just decided
> to use DNAT to redirect incoming tcp connections
> to the loopback interface.... but for some reason you
> hopefully already know about, it doesn't seem to work.
>
> So, while this iptables rule does work for port forwarding
> to another host:
>
> iptables -t nat -A PREROUTING -p tcp -i eth0 -m multiport \
> --dports mysql -j DNAT --to some.other.host
>
> changing "some.other.host" to 127.0.0.1 doesn't work
> as expected, and packets seem to be dropped altogether.
> Using tcpdump i can see packets reaching eth0, but
> never reaching loopback.
>
> Is there any way to make iptables do what i'm looking
> for? Any help will be greatly appreciated.
>
> Thanks much.
>
> --
> Damian Gatabria <damian_g@speedy.com.ar>
>
>
Is your FORWARD chain set to DROP? Is so, do you have the rule in the
FORWARD chain that allows traffic from eth0 to localhost?
Example:
iptables -t nat -A PREROUTING -p tcp -i eth0 -m multiport \
--dports mysql -j DNAT --to some.other.host
iptables -A FORWARD -p tcp -d some.other.host --dport some.port -j ACCEPT
Correct me if I'm wrong.
Greets,
Klemen Kecman
next prev parent reply other threads:[~2004-08-06 11:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-06 11:38 iptables dnat to loopback Damian Gatabria
2004-08-06 11:54 ` Klemen Kecman [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-08-06 12:48 Jason Opperisano
2004-08-06 17:13 Jason Opperisano
2004-08-07 10:15 ` David Cannings
2004-08-08 6:17 ` Damian Gatabria
2004-08-08 8:41 ` David Cannings
2004-08-08 17:50 ` Alistair Tonner
2004-08-09 14:40 ` Damian Gatabria
2004-08-10 1:29 ` Damian Gatabria
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='002401c47bac$313d0350$6a02a8c0@klemen' \
--to=klemen@sting.si \
--cc=netfilter@lists.netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox