Measuring data transferred through an interface?

Matthew Seaman m.seaman at
Sun Feb 9 17:45:20 GMT 2003

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Feb 09, 2003 at 04:39:19PM +0000, Jonathan Belson wrote:

> It seems that NTL are going to be limiting cable users to 1GB a day, which
> got me wondering exactly how many bytes I transfer on a daily basis.
> My cable modem is connected to a server which performs NAT for machines
> connected to it.  Since all my external traffic travels through a single
> interface, is there an easy way to measure how much data travels through
> it?

If all you want is the total number of bytes transferred, you can run:

    % netstat -ib

to get packet and byte IO counts since the last reboot.  A script to
convert that into daily usage is left as an exercise for the student.

You could also break the traffic down by source or destination address
or port numbers by using ipfw(8) count rules.

There's also mrtg and/or rrdtool (both in ports) which will give you
some nice graphs showing activity --- mrtg runs by using SNMP to query
the traffic counters for the interface, and generating graphs for
display via a web site.  rrdtool is the next generation graphing
system for which you'll have to put together a data gathering system.
You can combine the mrtg data gathering with the rrdtool graphing:



Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP:         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.1 (FreeBSD)



More information about the Ukfreebsd mailing list