Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Curtis Hawthorne <mrperson@mrperson.org>
To: netfilter@lists.netfilter.org
Subject: Bandwidth tracking per user
Date: Wed, 11 Jan 2006 13:56:42 -0600	[thread overview]
Message-ID: <43C562FA.8010705@mrperson.org> (raw)

Hi all,

I'm trying to put together a solution for tracking the bandwidth usage
of each local user on a shared server.  At first, I thought I could just
create a rule for each user with the --uid-owner match on all traffic
and look at the counter for that rule.  But, I found out it will only
work on LOCAL_OUT or POST_ROUTING.  So, the solution I came up with was
to use the --uid-owner to set a mark on the connection on an outgoing
packet and then use that mark to track the incoming traffic.  Here's an
example of what I was doing to track root's incoming and outgoing traffic:

iptables -t filter -A OUTPUT -m owner --uid-owner 0 -j CONNMARK --set-mark 0

iptables -A INPUT -m connmark --mark 0

This seems like a strange way to do things to me.  Is there a better way
to track total bandwidth usage for local users, or will this way work?

Thanks!

Curtis H.



                 reply	other threads:[~2006-01-11 19:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=43C562FA.8010705@mrperson.org \
    --to=mrperson@mrperson.org \
    --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