From owner-freebsd-questions@FreeBSD.ORG Sat Apr 10 13:36:52 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 780C416A4CE for ; Sat, 10 Apr 2004 13:36:52 -0700 (PDT) Received: from out012.verizon.net (out012pub.verizon.net [206.46.170.137]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1C85F43D3F for ; Sat, 10 Apr 2004 13:36:52 -0700 (PDT) (envelope-from cswiger@mac.com) Received: from mac.com ([68.160.247.127]) by out012.verizon.net (InterMail vM.5.01.06.06 201-253-122-130-106-20030910) with ESMTP id <20040410203651.HEOU18295.out012.verizon.net@mac.com>; Sat, 10 Apr 2004 15:36:51 -0500 Message-ID: <40785AC9.5050305@mac.com> Date: Sat, 10 Apr 2004 16:36:25 -0400 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040316 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dragoncrest References: <200404102020.i3AKKLfb007744@mail5.mx.voyager.net> In-Reply-To: <200404102020.i3AKKLfb007744@mail5.mx.voyager.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Authentication-Info: Submitted using SMTP AUTH at out012.verizon.net from [68.160.247.127] at Sat, 10 Apr 2004 15:36:51 -0500 cc: questions@freebsd.org Subject: Re: Bandwidth tracking/monitoring on Freebsd X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2004 20:36:52 -0000 Dragoncrest wrote: > Hi all. Got a question. I got a box on my network that I'd like to be > able to track bandwidth usage on. Just to see how much traffic is > passing through it in a one month period and daily over a 24 hour > period. Is there some kind of application I can use to log total bytes > sent and total bytes recieved? I don't need to know specifically WHAT > was sent, but rather HOW MUCH of it was sent. [ ... ] Try something like the following IPFW rules, replacing IIF with the name of the network interface you want to pay attention to: add pipe 11 tcp from any to any in via IIF add pipe 11 udp from any to any in via IIF add pipe 11 ip from any to any in via IIF pipe 11 config queue 60 add pipe 12 tcp from any to any out via IIF add pipe 12 udp from any to any out via IIF add pipe 12 ip from any to any out via IIF pipe 12 config queue 60 The normal periodic processing ought to cause these stats to be reset daily. This really is the easiest way of accomplishing what you've asked for, but: > What is the easiest way to do this short of setting up IPFW and doing a > kernel compile and all that nasty stuff. Any suggestions will be welcome. ...another approach would be to run 'netstat -s' on a daily basis, parse the output, and subtract values to obtain daily deltas. You'd have to write 10-20 lines of shell code using grep and awk, or use Python or Perl to do the task. -- -Chuck