Iptables and counters

iptablesnat;traffic

I'm trying to use iptables counters with munin to monitor traffic of hosts on my local subnet. For each host I set up a rule like this:

iptables -I OUTPUT -d $ip

This should count the packets going from firewall to $ip, correct?

I found out that this does not seem to count all packets. I start tcpdump on my router (Linux) and I see packets to $ip that are not counted.

For example I check number of packets for rule to my phone IP. I start tcpdump, refresh Gmail on my phoone, I see packets in tcpdump's output but iptables rule counters are not incremented. Then I open a web page on the same phone and the counters are incremented.

What could be the reason?

Best Answer

The OUTPUT chain is used by packets output from the firewall itself.

The chain you want to use is FORWARD, which is used by packets forwarded by the firewall.