Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Richard Hauswald" <richard.hauswald@gmx.de>
To: netfilter@lists.netfilter.org
Subject: problem matching marked packets in nat PREROUTING chain
Date: Mon, 04 Jun 2007 13:29:59 +0200	[thread overview]
Message-ID: <20070604112959.44020@gmx.net> (raw)

Hello folks,
i'm trying to do the following:

mangle - PREROUTING : marking packets with 23 containing a string "formula1"
nat_PREROUTING: matching packets marked with 23 and Log them

I used the following commands:
iptables -t mangle -A PREROUTING -m string --string formula1 --algo kmp -j MARK --set-mark 23
iptables -t nat -I PREROUTING -p tcp -m mark --mark 23 -j LOG

For debug purpose i added the following rule to the mangle PREROUTING
iptables -t mangle -A PREROUTING -p tcp -m mark --mark 23 -j LOG

then i send the packets to the network interface and used the following commands to check if the rules are working correctly:
iptables -t mangle -vnL:

Chain PREROUTING (policy ACCEPT 557K packets, 326M bytes)
 pkts bytes target     prot opt in     out     source               destination
    1   482 MARK       0    --  *      *       0.0.0.0/0            0.0.0.0/0           STRING match "formula1" ALGO name kmp TO 65535MARK set 0x17
    1   241 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           MARK match 0x17 LOG flags 0 level 4

Chain INPUT (policy ACCEPT 12380 packets, 1786K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain FORWARD (policy ACCEPT 544K packets, 325M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 11765 packets, 1841K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain POSTROUTING (policy ACCEPT 554K packets, 326M bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain PREROUTING (policy ACCEPT 3707 packets, 424K bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           MARK match 0x17 LOG flags 0 level 4

Chain POSTROUTING (policy ACCEPT 2224 packets, 294K bytes)
 pkts bytes target     prot opt in     out     source               destination

Chain OUTPUT (policy ACCEPT 2284 packets, 188K bytes)
 pkts bytes target     prot opt in     out     source               destination


My question is now why doas the rule placed in the mangle matches the mark and the same one in nat doas not?

Thanks a lot,
Richard
-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail


             reply	other threads:[~2007-06-04 11:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-04 11:29 Richard Hauswald [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-06-04 11:27 problem matching marked packets in nat PREROUTING chain Richard Hauswald
2007-06-04 17:43 ` Pascal Hambourg

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=20070604112959.44020@gmx.net \
    --to=richard.hauswald@gmx.de \
    --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