This question already has an answer here:
- Iptables rules with ! character 3 answers
If you don't give iptables a target, it simply counts how many bytes and packets match the rule. I'd like to count all packets that come from outside, i.e. don't match 10.0.0.0/8 and don't match 192.168.0.0/16.
My first intuition is:
iptables -A INPUT ! -s 10.0.0.0/8,192.168.0.0/16
However this adds two rules, of which each count separately, and no count of outside packets is discernible. So how do I count outside packets?