Measuring data transferred through an interface?

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


--EeQfGwPcQSOJBaQU
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.
>=20
> 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:
http://www.fi.muni.cz/~kas/mrtg-rrd/

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+RpOwdtESqEQa7a0RAtBYAJ42Ee9nEEMa+ym/f4g3GWt2+dkRWwCeNVLC
6kacpb9YAbdbm3Y3a/0gQc8=
=NgiG
-----END PGP SIGNATURE-----

--EeQfGwPcQSOJBaQU--




More information about the Ukfreebsd mailing list