From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@vger.kernel.org
Subject: Re: CONNMARK and ip rule fwmark
Date: Sun, 30 Mar 2008 18:10:16 +0200 [thread overview]
Message-ID: <47EFBB68.1020107@plouf.fr.eu.org> (raw)
In-Reply-To: <alpine.LNX.1.10.0803301648110.28605@fbirervta.pbzchgretzou.qr>
Jan Engelhardt a écrit :
>
> On Sunday 2008-03-30 13:23, Franck JONCOURT wrote:
>
>> What about using the nat table to add your mark on a whole connection
>> instead of using the mangle table ?
>
> Using the nat table to 'simulate' -m conntrack --ctstate NEW, that's
> just a gross hack IMO.
I agree that the use of the nat table for any purpose not related to NAT
should be avoided. However the advantage of the nat table is that it
sees only one packet per connection, while "-m conntrack --ctstate NEW"
or "-m state --state NEW" may match multiple packets per connection,
e.g. duplicate TCP SYN or all UDP sent packets in the original direction
before the first packet sent in the return direction.
>>> If I remove "fwmark 71" in the "ip rule add" command, then it is working,
>>> but has side effects with the following:
>>>
>>> # iptables -t nat -A PREROUTING -p TCP -d publicip -j DNAT --to 10.4.0.1
>>>
>>> My observations seem to tell me, that ip rule is evaluated BEFORE
>>> iptables rules are applied, so the mark is not set yet.
>
> See http://jengelh.hopto.org/images/nf-packet-flow.png , routing
> decision takes place in the middle. (It's called _PRE_ROUTING_ for a
> reason.)
My understanding is that the side effects mentioned by the OP apply to
the return packets of DNATed connections, which go through the OUTPUT
chains. The diagram show that a routing decision occurs before the
OUTPUT chains, but a rerouting may occur because of a mark or
destination NAT.
next prev parent reply other threads:[~2008-03-30 16:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-30 11:03 CONNMARK and ip rule fwmark Steffen Heil
2008-03-30 11:23 ` Franck JONCOURT
2008-03-30 14:53 ` Jan Engelhardt
2008-03-30 15:08 ` Franck JONCOURT
2008-03-30 16:10 ` Pascal Hambourg [this message]
2008-03-30 18:27 ` Jan Engelhardt
2008-03-30 18:58 ` Pascal Hambourg
2008-03-30 16:21 ` Steffen Heil
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=47EFBB68.1020107@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