Pattern Matching of Postrouting Chain
Hi,
Hope that this will be post to the mailing list. My task is to
(1) Read a set of IPs from a configuration file
(2) Match this set of IPs with all the entry in POSTROUTING chain
(3) IF any entry that matches criterias (pkts > 10000 AND bytes > 30M), output the entries into a file.
(4) All in all:-
INPUT:- Host IPs
OUTPUT:- pkts and bytes of that Host
Example:-
Chain POSTROUTING (policy ACCEPT 16M packets, 15G bytes)
pkts bytes target prot opt in out source destination
93643 33M MARK tcp -- * eth1 0.0.0.0/0 192.168.8.250 MARK set 0x2
0 0 MARK all -- * eth1 0.0.0.0/0 192.168.250.75 MARK set 0x3
0 0 MARK all -- * eth1 0.0.0.0/0 192.168.250.75 MARK set 0x3
0 0 MARK all -- * eth1 0.0.0.0/0 192.168.250.75 MARK set 0x3
0 0 MARK all -- * eth1 0.0.0.0/0 192.168.250.75 MARK set 0x3My questions are:-
(1) Can I do this with current iptables?
(2) If not? Should I start writting extension for iptables? Which documentation can get me get started?
Hope to hear from you soon :)
Thank you
Warm regards,
Calvin