Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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  --  *      *       0.0.0.0/0            0.0.0.0/0           tcp spt:6532 MARK set 0xfffc 
  146 54635 MARK       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.