Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Steven M Campbell <Netfilter@SCampbell.net>
To: iptables <netfilter@lists.netfilter.org>
Subject: Re: Packets Counting
Date: Wed, 16 Mar 2005 12:54:37 -0500	[thread overview]
Message-ID: <423872DD.8020009@SCampbell.net> (raw)
In-Reply-To: <4238655B@webmail.wichita.edu>

M. A. Imam wrote:

>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 
>
>
>  
>
iptables -L -v will show packet counts and byte counts on rules so, 
using your specific example and assuming you meant tcp port 5001

First create a matching rule that has no target
#  iptables -I INPUT 1 -p tcp --dport 5001

Then, every x seconds run
iptables -L -v -n
and parse out the counter of interest.

Hope that helps,
SCampbell






  parent reply	other threads:[~2005-03-16 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-16 15:56 Packets Counting M. A. Imam
2005-03-16 17:43 ` Seferovic Edvin
2005-03-16 17:54 ` Steven M Campbell [this message]
2005-03-16 21:24 ` Maxime Ducharme
2005-03-16 21:33 ` R. DuFresne
  -- strict thread matches above, loose matches on Subject: below --
2005-03-16 17:50 M. A. Imam
2005-03-16 18:08 ` Bill Chappell
2005-03-16 19:15 Bill Chappell
2005-03-16 19:28 ` Steven M Campbell
2005-03-17  9:11 ` Jose Maria Lopez Hernandez

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=423872DD.8020009@SCampbell.net \
    --to=netfilter@scampbell.net \
    --cc=netfilter@lists.netfilter.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