From: "John A. Sullivan III" <jsullivan@opensourcedevel.com>
To: Will Kuhn <willkuhn76@yahoo.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: question about the order of the rules of iptables
Date: Thu, 08 Sep 2005 08:23:45 -0400 [thread overview]
Message-ID: <1126182225.2631.28.camel@localhost> (raw)
In-Reply-To: <20050908120114.76595.qmail@web60421.mail.yahoo.com>
On Thu, 2005-09-08 at 05:01 -0700, Will Kuhn wrote:
> Will the order of the following two rules make any
> difference in the outcome ? I personally feel that it
> should not. Can anyone confirm ?
>
> My intention is to have the incoming mails first
> checked by the local anti-spam process listening at
> port 1025 before being forwarded to the local mail
> server. 10.1.1.100 is a private ip address of the
> local mail server.
>
> Local Mail server ----- [eth0] LinuxBOX [eth1] ----
> internet
>
> iptables -t nat -A PREROUTING -i eth1 -p tcp --dport
> 25 -j DNAT --to 10.1.1.100
>
> iptables -t nat -A PREROUTING -i eth1 -p tcp --dport
> 25 -j REDIRECT --to-port 1025
>
<snip>
That may depend on what you want to do. First, if I recall properly
(and I may not), REDIRECT sends the packet to port 1025 on interface lo,
i.e., to the local machine. It is not used for changing the port. That
may be what you want. If you really want to change the port but not
redirect the packet to the local computer, use the port parameter on
DNAT, e.g., --to-destination 10.1.1.100:1025.
Second, I believe packets stop traversing a chain once they have been
matched with the DNAT target (I'm not sure about REDIRECT). Thus, a
packet matching rule #1 in your order would never see rule #2.
I'm fetching this out of somewhat distant memory so, if someone knows
better, please correct me - John
--
John A. Sullivan III
Open Source Development Corporation
+1 207-985-7880
jsullivan@opensourcedevel.com
If you would like to participate in the development of an open source
enterprise class network security management system, please visit
http://iscs.sourceforge.net
next prev parent reply other threads:[~2005-09-08 12:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-08 12:01 question about the order of the rules of iptables Will Kuhn
2005-09-08 12:23 ` John A. Sullivan III [this message]
2005-09-08 17:09 ` Will Kuhn
2005-09-08 17:59 ` Rob Sterenborg
2005-09-08 18:07 ` John A. Sullivan III
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=1126182225.2631.28.camel@localhost \
--to=jsullivan@opensourcedevel.com \
--cc=netfilter@lists.netfilter.org \
--cc=willkuhn76@yahoo.com \
/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