Skip to contentSkip to conversation

How to debug nfmarking

DISCUSSION Eduardo Fernández 3 participants 3 messages Nov 15, 2004

lore
Share & tools
lore
#0 lore raw

Hi all,

i'm trying to debug packet marking like this:

iptables -t mangle -A PREROUTING -p icmp -j MARK --set-mark 0x1 (...)

But I don't know how to check if the packets are really being marked. ip_conntrack shows all packets with mark=0, and that's not possible. I've tried logging with netfilter but I don't know which option shows the nfmark in the log. Any ideas?

Thank you very much in advance.

Eduardo

#1 lore raw
Quoted 7 lines · Eduardo Fernández

Hi all,

i'm trying to debug packet marking like this:

iptables -t mangle -A PREROUTING -p icmp -j MARK --set-mark 0x1 (...)

Quoted 8 lines

But I don't know how to check if the packets are really being marked. ip_conntrack shows all packets with mark=0, and that's not possible. I've tried logging with netfilter but I don't know which option shows the nfmark in the log. Any ideas?

Thank you very much in advance.

Eduardo

add a log rule that matches on the mark:

  iptables -t mangle -A PREROUTING -p icmp -j MARK --set-mark 1
  iptables -t mangle -A PREROUTING -m mark --mark 1 \
    -j LOG --log-prefix "FW MARK 1: "

-j

--
"Beer. Now there's a temporary solution."
--The Simpsons

#2 lore raw
In reply to Eduardo Fernández
Quoted 8 lines · Eduardo Fernández

Hi all,

i'm trying to debug packet marking like this:

iptables -t mangle -A PREROUTING -p icmp -j MARK --set-mark 0x1 (...)
But I don't know how to check if the packets are really being marked. ip_conntrack shows all packets with mark=0, and that's not possible.

yes, you need to explicitly save mark with CONNMARK to have the mark being propagated through the connection.
See http://home.regit.org/connmark.html for details.

BR,

Signature · 2 lines
Eric Leblond <[email protected]>
INL