From: "pevee" Subject: Pattern Matching of Postrouting Chain Date: Tue, 1 Oct 2002 16:54:37 +0800 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <009501c26928$2dbe26c0$60faa8c0@gpcalvin> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0092_01C2696B.39B84530" Return-path: To: Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org This is a multi-part message in MIME format. ------=_NextPart_000_0092_01C2696B.39B84530 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi,=20 Hope that this will be post to the mailing list. My task is to=20 (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 0x3 My 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,=20 Calvin ------=_NextPart_000_0092_01C2696B.39B84530 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
   Hope that this will be = post to the=20 mailing list. My task is to
 
(1) Read a set of IPs from a = configuration=20 file
(2) Match this set of IPs with all the = entry in=20 POSTROUTING chain
(3) IF any entry that matches criterias = (pkts >=20 10000 AND bytes > 30M), output the entries into a file.
(4) All in all:-
 
    INPUT:- Host = IPs
    OUTPUT:- pkts = and bytes of=20 that Host
 
Example:-
 
Chain POSTROUTING (policy ACCEPT 16M = packets, 15G=20 bytes)
 pkts bytes target     prot opt=20 in     out    =20 source           &= nbsp;  =20 destination
93643   33M = MARK      =20 tcp  --  *      = eth1   =20 0.0.0.0/0          &nbs= p;=20 192.168.8.250      MARK set = 0x2
   =20 0     0 MARK       = all =20 --  *      eth1   =20 0.0.0.0/0          &nbs= p;=20 192.168.250.75     MARK set = 0x3
   =20 0     0 MARK       = all =20 --  *      eth1   =20 0.0.0.0/0          &nbs= p;=20 192.168.250.75     MARK set = 0x3
   =20 0     0 MARK       = all =20 --  *      eth1   =20 0.0.0.0/0          &nbs= p;=20 192.168.250.75     MARK set = 0x3
   =20 0     0 MARK       = all =20 --  *      eth1   =20 0.0.0.0/0          &nbs= p;=20 192.168.250.75     MARK set 0x3
 
My questions are:-
 
(1) Can I do this with current=20 iptables?
(2) If not? Should I start writting = extension for=20 iptables? Which documentation can get me get started?
 
Hope to hear from you soon = :)
Thank you
 
Warm regards,
 
Calvin
------=_NextPart_000_0092_01C2696B.39B84530--