From owner-freebsd-net@FreeBSD.ORG Thu Jun 26 15:45:22 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CC5637B404 for ; Thu, 26 Jun 2003 15:45:22 -0700 (PDT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6840243FDF for ; Thu, 26 Jun 2003 15:45:21 -0700 (PDT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.9/8.12.9) with ESMTP id h5QMitKJ067756; Thu, 26 Jun 2003 18:44:56 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)h5QMitK0067753; Thu, 26 Jun 2003 18:44:55 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Thu, 26 Jun 2003 18:44:55 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Adam In-Reply-To: <1056467581.42828.26.camel@jake> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: net@freebsd.org Subject: Re: Bandwidth monitoring X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jun 2003 22:45:22 -0000 On 24 Jun 2003, Adam wrote: > My ISP is placing strict restrictions on how much I can transfer each > month, with high penalties for exceeding their limits. However, they > don't provide any way for their customer's to check to see how much > they've transferred, so we end up transferring far less than what we are > allowed, just to make sure we avoid paying the fines for going over the > limit. > > So, what I need to do is find a way to monitor my total bandwidth > through my external NIC. My gateway is running FreeBSD 4.8 with > ipf+ipnat. > > I *don't* need anything fancy. All I need is to be able to check at any > time how much I've transferred since the first of the month. What's the > easiest way to set up something like this? I know there are fancy > solutions with graphs with usage stats and such, but that's not what I'm > after. > > Thanks for your advice, I use the following home-grown tool to measure bandwidth consumed by the hosts on my ethernet segment: http://www.watson.org/~robert/freebsd/bpfmon.tgz It uses BPF to monitor traffic on the segment, and drops bandwidth samples into a data directory every five minutes. there's a post-processing script that generates a CSV of samples, by local host, for easy consumption in a spreadsheet. It's not a great program, but it is cute and works. Make sure to read the README if you use it; you have to set a few things at compile-time, since I wrote it for local use and never really attempted to generalize. I use it to monitor inbound and outbound IP traffic for around 400 hosts here for precisely the same reason you are interested :-). Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Network Associates Laboratories