Revision 2 not available (showing current revision instead)

Traffic accounting

Difference between revision 2 and current revision

No diff available.

Make a new accounting chain, affectionally known as ACCT:

 # iptables -N ACCT

This chain counts incoming and outgoing traffic.

 # iptables -A ACCT -i lo
 # iptables -A ACCT -o lo

Given our new chain, we want to have traffic run through it. Add rules to make
the incoming and outgoing traffic run through our accounting chain. Specify
those rules without any characteristics defined (like target, source, port,
etc), so every packet matches this rule:

 # iptables -A INPUT -i lo -j ACCT
 # iptables -A OUTPUT -o lo -j ACCT

Great, we've got counting. To read it out and set counters to zero:

 # iptables -L -Z ACCT -vxn