From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: "netfilter@vger.kernel.org" <netfilter@vger.kernel.org>
Subject: Re: DMZ issue - redirect works as expected but behaviour not desired
Date: Sun, 20 Feb 2011 00:10:03 +0100 [thread overview]
Message-ID: <4D604DCB.8030409@plouf.fr.eu.org> (raw)
In-Reply-To: <41BA18AA-DB18-493A-9429-37A188A2442B@utpress.utoronto.ca>
Hello,
Feasey, Nicholas a écrit :
> I'm setting up a box that will be the only device on the Internet and
> will forward requested services to other servers sitting on a DMZ.
>
> As a test I started with redirecting a web server.
>
> To test my arrangement I first merely set up a simple masquerade (just
> on my internal network) in my iptables like so:
>
> *nat
> :PREROUTING ACCEPT [0:0]
> :POSTROUTING ACCEPT [0:0]
> -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to 192.168.40.15
> -A POSTROUTING -j MASQUERADE
Be aware that using MASQUERADE on all interfaces may not do what you
want. Usually, it is used only on the public internet side.
> *filter
> ...normal filtering lines follow.
>
> This POSTROUTING entry works as well:
>
> -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.40.15
>
> I think this is because the above line is doing the same as the shortcut
> MASQUERADE.
Not exactly. This rule replaces the source address of any connection
going out eth0 with 192.168.40.15 whereas the above MASQUERADE rule
replaces the source address of any connection going out any interface
with the address of the interface.
By the way, it is weird that you use the address of a remote host (the
server in the DMZ).
> When I check the httpd access_log it shows that the connection came from
> 192.168.40.15 as expected. It works.
I'm puzzled. A connection cannot match both the DNAT and SNAT rules as
they have the same input and output interface eth0. Even if it did (the
connection goes out the interface it came in), this connection would end
up having the same address as source and destination 192.168.40.15.
next prev parent reply other threads:[~2011-02-19 23:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-19 20:55 DMZ issue - redirect works as expected but behaviour not desired Feasey, Nicholas
2011-02-19 23:10 ` Pascal Hambourg [this message]
2011-02-20 0:24 ` Feasey, Nicholas
[not found] ` <AANLkTi=rkXhB9UC=jG_wfF3P0MRjk4z-BVWjx4w=gb3m@mail.gmail.com>
2011-02-20 1:34 ` Pandu Poluan
2011-02-20 2:58 ` Feasey, Nicholas
2011-02-20 5:24 ` Pandu Poluan
2011-02-20 6:07 ` Feasey, Nicholas
2011-02-20 14:37 ` Pandu Poluan
2011-02-23 1:31 ` Feasey, Nicholas
2011-02-23 6:17 ` Pandu Poluan
2011-02-23 17:02 ` Feasey, Nicholas
2011-02-24 0:19 ` Pandu Poluan
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=4D604DCB.8030409@plouf.fr.eu.org \
--to=pascal.mail@plouf.fr.eu.org \
--cc=netfilter@vger.kernel.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