Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Artūras Šlajus" <x11@arturaz.net>
To: Richard Hartmann <richih.mailinglist@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: (Ab)using iptables to record byte count per IP?
Date: Fri, 09 Jan 2009 13:50:43 +0200	[thread overview]
Message-ID: <49673A13.6050807@arturaz.net> (raw)
In-Reply-To: <2d460de70901090327y625afd60g792467e843d3f1d@mail.gmail.com>

Richard Hartmann wrote:
 > Hi all,
 >
 > I need to log the traffic each local IP in a NAT'ed network generates
 > per day.
 >
 > Unfortunately, the environment is rather restricted and compiling new
 > software is not an option. Thus, I am wondering if I can abuse iptables,
 > which is in use anyway, to log for me, as well.
 >
 > The end result should be a log which contains IP, date and traffic
 > generated. I don't really care about the output format as I will perl it
 > into the format I need, anyway.

iptables -N ACCOUNTING
iptables -A FORWARD -j ACCOUNTING
iptables -A ACCOUNTING -s your_user_ip -j ACCEPT
iptables -A ACCOUNTING -d your_user_ip -j ACCEPT

bam, with iptables -L ACCOUNTING -n -v you can have packet/byte counters ;)

  reply	other threads:[~2009-01-09 11:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-09 11:27 (Ab)using iptables to record byte count per IP? Richard Hartmann
2009-01-09 11:50 ` Artūras Šlajus [this message]
2009-01-09 11:55   ` Thomas Jacob
2009-01-09 12:46     ` Richard Hartmann
2009-01-10  2:55     ` Amos Jeffries
2009-01-09 12:44   ` Richard Hartmann
2009-01-09 17:10     ` Robert Nichols
2009-01-09 12:35 ` Pablo Neira Ayuso
2009-01-09 12:47   ` Richard Hartmann
2009-01-09 15:23 ` Payam Chychi
2009-01-09 23:27   ` Vlado Drz(ík
2009-01-09 16:36 ` Peter Renzland

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=49673A13.6050807@arturaz.net \
    --to=x11@arturaz.net \
    --cc=netfilter@vger.kernel.org \
    --cc=richih.mailinglist@gmail.com \
    /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