[H-GEN] Bandwidth logging of internet broadband for local network

Tony Nugent tony at linuxworks.com.au
Tue Feb 19 08:35:02 EST 2002


[ Humbug *General* list - semi-serious discussions about Humbug and  ]
[ Unix-related topics.  Please observe the list's charter.           ]
[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]

On Tue Feb 19 2002 at 21:32, Matthew Sellers wrote:

> I am trying to find information on ways to measure the bandwidth used by
> individual clients for a shared broadband internet connection.
> So far I have only been able to find information on how to set up a shared
> internet connection, nothing on how to measure it.

If you are using linux with ipchains or iptables, you get packet and
byte counts by default.

You need to set up some ipchains/iptables rules to count the traffic
that you are interested in (eg packets being forwarded between the
internet and the hosts in your intranet).  Then you can view the
statistics at any time by using the -nvL or -nvxL switches to
ipchains/iptables.

> Ideally I am trying to find a program that measures the traffic originating
> from and going to the internet for several clients in order to avoid
> exceeding the usage cap.

Set up a cron job, to parse the output from the ipchains/iptables
command with something like a perl script to glob out what you need,
then make decisions based on the results.

> Thanks
> --
> Matthew Sellers

Another possbile way to do this is with route accounting, which is
done by setting up (possibly otherwise unnecessary) routes with the
/sbin/ip utility, assigning host routes to realms.  Then the rtacct
command will give you the statistics for those routes.  However,
this is not so flexable as ipchains/iptables... for example, I know
of no way to reset the rt_acct counters to zero or to pre-determined
values.

  BTW, /sbin/ip is the "new-age" network configuration tool, it is
  very powerful.  It obseletes /sbin/ifconfig and /sbin/route.

Cheers
Tony
---*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=---
  Tony Nugent <Tony at linuxworks.com.au>
  LinuxWorks - Gold Coast Qld Australia

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list