Linux Netfilter discussions
 help / color / mirror / Atom feed
* RE: Packets Counting
@ 2005-03-16 17:50 M. A. Imam
  2005-03-16 18:08 ` Bill Chappell
  0 siblings, 1 reply; 10+ messages in thread
From: M. A. Imam @ 2005-03-16 17:50 UTC (permalink / raw)
  To: edvin.seferovic, netfilter

Can i record the the number of packets each 2 seconds with tcpdump. i can see
packets with tcpdump but how to count it every 2 seconds

>===== Original Message From edvin.seferovic@kolp.at =====
>Maybe you should use tcpdump for testing purposes instead of using iptables.
>
>Just my opinion.
>
>Regards,
>
>Edvin
>
>-----Original Message-----
>From: netfilter-bounces@lists.netfilter.org
>[mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of M. A. Imam
>Sent: Mittwoch, 16. März 2005 16:56
>To: netfilter@lists.netfilter.org
>Subject: Packets Counting
>
>Hi,
>
>How can i count the number of packets on an interface evry 2 or 5 seconds.
>and
>i want to count only specific packets like only arriving packets from port
>5001
>
>Any ideas...
>
>Muhammad



^ permalink raw reply	[flat|nested] 10+ messages in thread
* Re: Packets Counting
@ 2005-03-16 19:15 Bill Chappell
  2005-03-16 19:28 ` Steven M Campbell
  2005-03-17  9:11 ` Jose Maria Lopez Hernandez
  0 siblings, 2 replies; 10+ messages in thread
From: Bill Chappell @ 2005-03-16 19:15 UTC (permalink / raw)
  To: netfilter@lists.netfilter.org


I do not have time this instant to share the code but the outline of
a packet counter I use is to create chain MANGLE_ACTIVITY in -t mangle,
add a rule that simply RETURNs to MANGLE_ACTIVITY, Insert a jump to the
MANGLE_ACTIVITY chain in -t mangle PREROUTING (so it is the first chain
hit by all incoming packets), use whatever matches, like --sport or
--dport (remember to specify protocol with port matches) and/or an
interface match.  Then, in a script (mine happens to be Perl), run
"iptables -t mangle -nvL MANGLE_ACTIVITY" and pipe (|) it through grep
to get the RETURN line with the packet count and pipe it through
awk to pick off the packet count followed by
"iptables -t mangle -Z MANGLE_ACTIVITY" to zero the counter,
both in a loop with a sleep to get the interval (approximately).

Hope this helps.

Bill

(Without deadlines, we'd live forever.)



M. A. Imam wrote:
> Can i record the the number of packets each 2 seconds with tcpdump. i can see 
> packets with tcpdump but how to count it every 2 seconds
> 
> 
>>===== Original Message From edvin.seferovic@kolp.at =====
>>Maybe you should use tcpdump for testing purposes instead of using iptables.
>>
>>Just my opinion.
>>
>>Regards,
>>
>>Edvin
>>
>>-----Original Message-----
>>From: netfilter-bounces@lists.netfilter.org
>>[mailto:netfilter-bounces@lists.netfilter.org] On Behalf Of M. A. Imam
>>Sent: Mittwoch, 16. März 2005 16:56
>>To: netfilter@lists.netfilter.org
>>Subject: Packets Counting
>>
>>Hi,
>>
>>How can i count the number of packets on an interface evry 2 or 5 seconds.
>>and
>>i want to count only specific packets like only arriving packets from port
>>5001
>>
>>Any ideas...
>>
>>Muhammad
> 
> 
> 
> 

-- 
William Chappell, Software Engineer, Critical Technologies Inc.
* Creativity * Diversity * Expertise * Flexibility * Integrity *
Suite 400 Technology Center, 4th Floor 1001 Broad St, Utica NY 13501
315-793-0248 x148 FAX -9710 <bill.chappell@critical.com> www.critical.com




^ permalink raw reply	[flat|nested] 10+ messages in thread
* Packets Counting
@ 2005-03-16 15:56 M. A. Imam
  2005-03-16 17:43 ` Seferovic Edvin
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: M. A. Imam @ 2005-03-16 15:56 UTC (permalink / raw)
  To: netfilter

Hi,

How can i count the number of packets on an interface evry 2 or 5 seconds. and 
i want to count only specific packets like only arriving packets from port 
5001

Any ideas...

Muhammad 



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-03-17  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-16 17:50 Packets Counting M. A. Imam
2005-03-16 18:08 ` Bill Chappell
  -- strict thread matches above, loose matches on Subject: below --
2005-03-16 19:15 Bill Chappell
2005-03-16 19:28 ` Steven M Campbell
2005-03-17  9:11 ` Jose Maria Lopez Hernandez
2005-03-16 15:56 M. A. Imam
2005-03-16 17:43 ` Seferovic Edvin
2005-03-16 17:54 ` Steven M Campbell
2005-03-16 21:24 ` Maxime Ducharme
2005-03-16 21:33 ` R. DuFresne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox