Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Costi <costi@cdvultur.com>
To: Martijn Lievaart <m@rtij.nl>
Cc: netfilter@lists.netfilter.org
Subject: Re: One little problem I don't understand
Date: Thu, 10 Aug 2006 10:55:43 +0300	[thread overview]
Message-ID: <44DAE67F.3010702@cdvultur.com> (raw)
In-Reply-To: <44DAE1DC.3080801@rtij.nl>

But still isn't iptables  *first rule wins* policy ? From what I know 
iptables runs with this policy?

Martijn Lievaart wrote:
> Vultur Constantin wrote:
>
>> Hi,
>>
>> I have a little problem understanding the way iptables does the 
>> matching of packets.
>> The problem is like this:
>> I have an subnet A.B.C.D/X which I mark it with --set-mark 1:
>>
>> $IPT -A fw-interfaces -i $INT_IF -s $INT_NET  -d A.B.C.D/X -m state 
>> --state NEW    -j ACCEPT
>> $IPT -t mangle -A PREROUTING -i $INT_IF -d A.B.C.D/X  -j MARK 
>> --set-mark 1
>>
>> and I mark the connections to port 22 ( ssh ) with --set-mark 2
>>
>> $IPT -A fw-interfaces -i $INT_IF -s $INT_NET  -p tcp --dport 22 -m 
>> state --state NEW    -j ACCEPT
>> $IPT -t mangle -A PREROUTING -i $INT_IF -p tcp --dport 22 -j MARK 
>> --set-mark 2  fw-interfaces is used as a custom chain in FORWARD.
>>
>> Now my problem is like this:
>> If I want to connect to ssh to one of the ip's from d A.B.C.D/X all 
>> my packets are set-marked with 2. The rule with d A.B.C.D/X   is 
>> above tho one with ssh.
>> Shouldn't the ssh connection to A.B.C.D/X  be marked with 1 ? If not 
>> what I am doing wrong.
>
>
> It IS marked with 1, subsequently overwritten by 2 by the second rule.
>
> HTH,
> M4
>



  reply	other threads:[~2006-08-10  7:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-09 20:14 One little problem I don't understand Vultur Constantin
2006-08-10  7:35 ` Martijn Lievaart
2006-08-10  7:55   ` Costi [this message]
2006-08-10  8:20     ` Rob Sterenborg
2006-08-10 12:13     ` Martijn Lievaart

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=44DAE67F.3010702@cdvultur.com \
    --to=costi@cdvultur.com \
    --cc=m@rtij.nl \
    --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