From: Srinivasa T N <seenutn@linux.vnet.ibm.com>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Re: Double rules for using NETFLOW?
Date: Thu, 03 Feb 2011 10:45:48 +0530 [thread overview]
Message-ID: <4D4A3A04.20505@linux.vnet.ibm.com> (raw)
In-Reply-To: <4D499ACA.2040603@riverviewtech.net>
On Wednesday 02 February 2011 11:26 PM, Grant Taylor wrote:
> On 2/2/2011 4:01 AM, Srinivasa T N wrote:
>> I am using ipt_NETFLOW 1.7 on my RHEL 6 (2.6.32) box. Now if I want to
>> accept packet destined for some port and at the same time I want it to
>> be accounted also, then I have to use the following rules:
>
> I take it that the accounting you want is more than the simple packet /
> byte counters that already exist.
But how will I have access to the counters from my user land app?
>
>> iptables -A INPUT --dport <portnum> -j NETFLOW
>> iptables -A INPUT --dport <portnum> -j ACCEPT
>>
>> This makes that every packet that I accept should have two rules (one
>> for accepting and one for accounting). Don't you people think that it
>> will increase the number of rules a packet has to traverse? Or is my
>> understanding wrong?
>
> You could do something like this:
>
> iptables -N myChain
> iptables -A myChain -j NETFLOW
> iptables -A myChain -j ACCEPT
>
> iptables -A INPUT --dport <portnum> -j myChain
>
> Doing this will reduce the number of matches that have to be performed
> and allow the (sub)chain to simply apply actions to the packets.
>
> This might seem like over kill with your simple example, but when you
> start putting multiple matches on each rule, or have more actions in
> sequence (i.e. LOG) you start gaining more quickly. Further if you have
> other rules that are matching other packets, they will not have to
> traverse the condition that they will not match more than one time.
>
> IPTables gives you a skeleton that you can do a lot of different things
> in. It's really up to you how you put it together and how you optimize
> rule traversal.
>
> In some ways I could liken IPTables (and brethren) to a simple
> programming language. As such, it's not the language its self that is
> the limitation, just your imagination on how you use said language. :-)
>
>
>
> Grant. . . .
> --
Regards,
Seenu.
next prev parent reply other threads:[~2011-02-03 5:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-02 10:01 Double rules for using NETFLOW? Srinivasa T N
2011-02-02 10:09 ` Giles Coochey
2011-02-02 17:56 ` Grant Taylor
2011-02-03 5:15 ` Srinivasa T N [this message]
2011-02-03 20:14 ` Grant Taylor
2011-02-04 5:02 ` Srinivasa T N
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D4A3A04.20505@linux.vnet.ibm.com \
--to=seenutn@linux.vnet.ibm.com \
--cc=netfilter@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox