All of lore.kernel.org
 help / color / mirror / Atom feed
From: VaibhaV Sharma <vaibhav@exocore.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] NAT statistics
Date: Thu, 14 Mar 2002 09:44:20 +0000	[thread overview]
Message-ID: <marc-lartc-101609841904658@msgid-missing> (raw)
In-Reply-To: <marc-lartc-101609787703220@msgid-missing>

Hello,
See the -v option in man iptables


       -v, --verbose
              Verbose output.  This option makes the list command
              show the interface address, the  rule  options  (if
              any), and the TOS masks.  The packet and byte coun­
              ters are also listed, with the suffix 'K',  'M'  or
              'G' for 1000, 1,000,000 and 1,000,000,000 multipli­
              ers respectively (but see the  -x  flag  to  change
              this).   For  appending,  insertion,  deletion  and
              replacement, this causes  detailed  information  on
              the rule or rules to be printed.


This would give you the amount of data transferred for each rule that you
have in ur firewall as one of the columns

I wrote a small script to extract amount of data for each client I am
allowing FORWARD. The script takes the IP address of the machine you wanna
find info about as the command line parameter.

------------------------------------------------
#!/bin/sh

details=`/sbin/iptables -L -v -n | grep ACCEPT | grep -v INPUT | grep -v
OUTPUT | tr -s " " | grep $1 | cut -d" " -f 3,9,12`

bytes=`echo $details | cut -d" " -f1`
ip=`echo $details | cut -d" " -f2`

echo "IP address $ip transferred $bytes bytes."

------------------------------------------------

The cut thingi's are customised to the output I get for my rules. Check
urs and modify.

VaibhaV


On Thu, 14 Mar 2002 11:30:01 +0200 (EET) "Sebastian Taralunga"
<seba@tcx.ro> wrote:

> 
> Hi,
> 
> I want to be able to get statistics per IP address for both incoming and
> outgoing traffic on a NAT server using iptables and kernel v2.4.18. I
> actually have the same problem for a server running kernel v2.2.20,
> using ipchains.. Can anyone help me?
> 
> Regards,
> 
> Sebastian


 \                                                                  \
  \------------------------------------------------------------------\
\  |VaibhaV Sharma     |     vaibhav@exocore.com  |   L I N U X   \  |
 \ |Exocore Consulting |  http://www.exocore.com  |                \ |
  \|Bangalore, India   |  +91(80)3440397,3341137  |   R O C K S     \|
   \-----------------------------------------------------------------/
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

  reply	other threads:[~2002-03-14  9:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-14  9:30 [LARTC] NAT statistics Sebastian Taralunga
2002-03-14  9:44 ` VaibhaV Sharma [this message]
2002-03-14 13:43 ` Sebastian Taralunga
2002-03-14 13:56 ` Tobias Geiger
2002-03-14 20:24 ` Steele, Tom
2002-03-14 20:50 ` Steele, Tom
2002-03-15  4:59 ` VaibhaV Sharma

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=marc-lartc-101609841904658@msgid-missing \
    --to=vaibhav@exocore.com \
    --cc=lartc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.