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

I'm struggling with some iptables rules. I'm a newbie in iptables. I found some resources where I get the following command related to iptables. This is stored in a file that will be executed.

[0:0] -A PREROUTING -s 10.1.0.0/24 -p tcp -m tcp --dport 81 -j DNAT --to-destination 10.1.0.6:3128

Can anybody explain me what does [0:0] mean? Also, some link related to this in iptables are welcome.

Thanks in advance!

P.S. If you need more rules, just let me know.

share|improve this question

2 Answers 2

up vote 8 down vote accepted

The [0:0] or [1280:144299] or whatever are the count of [Packets:Bytes] that have been trough the chain . They are saved when you run an iptables-save command and are used by the iptables-restore command to initialise the counters.


The Packets and bytes values can be useful for some statistical purposes. Issuing an iptables-save command with the -c argument would then make it possible for us to reboot without breaking our statistical and accounting routines. (Quoted from Iptables Tutorial 1.2.2 - by Oskar Andreasson) Conclusively, restoring the iptables rules with Packets and bytes specified will not affect the rule behavior, just will keep a "stateful" track of Packets respectively bytes that match the rule.

share|improve this answer
    
What if I save my rules with those specified. Does it influence the networking? If yes, how. –  artaxerxe Mar 28 '12 at 5:48

Every rule has two counters; the number of packets and the number of bytes that have matched each rule. The default policies also have counters.

This syntax goes in the input to iptables-restore and sets the counters to whatever number is in the square brackets. iptables-save puts the current value of the counters into the square brackets in its output.

You can see human-readable counts for each rule using:

iptables -L -n -v

and the raw values with

iptables -L -n -v -x
share|improve this answer

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.