Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two chians:

Chain OUTPUT (policy ACCEPT 68688 packets, 12M bytes)
 pkts bytes target     prot opt in     out     source               destination         
  146 54635 MARK       tcp  --  *      *             tcp spt:6532 MARK set 0xfffc 
  146 54635 MARK       tcp  --  *      *             tcp spt:6532 MARK set 0x5 

When I iptables -t mangle -m connmark --mark 0x5 -Z it will zero both 0xfffc and 0x5's counter, how to only reset the 0x5 chain's bytes counter?

share|improve this question
up vote 1 down vote accepted

Specifying the rule by number seems to work, i.e.

iptables --table mangle --zero OUTPUT 2

The following should give you the rule number(s) of rules matching a certain regex:

iptables --numeric --line-numbers --table mangle --list OUTPUT | grep 0x5 | awk '{print $1}'
share|improve this answer
No way to use mark id to zero it? – timy Apr 19 '12 at 18:05
Only by finding what the rule number is; I've added a possible approach in my answer. – mgorven Apr 19 '12 at 18:11
Thanks for the cool trick:) – timy Apr 19 '12 at 18:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.