Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Feb 2000 16:30:29 +0200
From:      Giorgos Keramidas <charon@hades.hell.gr>
To:        Sean-Paul Rees <sean@dreamfire.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Monitoring internet traffic on one interface
Message-ID:  <20000203163029.A92577@hades.hell.gr>
In-Reply-To: <3897C305.B121A9DC@dreamfire.net>; from sean@dreamfire.net on Tue, Feb 01, 2000 at 09:39:17PM -0800
References:  <3897C305.B121A9DC@dreamfire.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 01, 2000 at 09:39:17PM -0800, Sean-Paul Rees wrote:
> I've read about, and seen graphs produced by MRTG. To say the least, I
> was very impressed with the product :-)
> 
> I run FreeBSD on a machine with 2 NIC cards. It runs NAT for my cable
> modem here at home. I'm wondering if & how it is possible to setup MRTG
> and SNMP in such a way that it could monitor the bandwidth going in/out
> my cable modem and produce those lovely graphs. 
> 
> My network interfaces are setup like this:
> 
> 192.168.10.x <-> xl0 <-> FreeBSD+NATD <-> lnc1 <-> Cable Modem
> 
> The cable modem is plugged directly into lnc1.

If you don't want to install snmp tools, and you have ipfilter around,
you can set up some accounting rules in ipfilter, like for instance:

    count in on lnc1 all
    count out on lnc1 all

and then use ipfstat to see how many packets/bytes went through:

    # ipfstat -hanio
    10508 5287271 count in on lnc1 from any to any
    10397 1595520 count out on lnc1 from any to any

The configuration file of mrtg can be tweaked to get it's output from an
external program.  A small script that extract from ipfstat the numbers
you're interested in would be fine.  I'm using on a ppp0 link the
following script:

    #!/bin/sh
    ipfstat -haio | grep 'in on ppp0 from any to any' | cut -d' ' -f2
    ipfstat -haio | grep 'out on ppp0 from any to any' | cut -d' ' -f2

I think that all you need to change is ppp0 -> lnc1, and add an entry in
your mrtg.cfg that will call this script as an external program.  The
sample mrtg.cfg that comes with mrtg's distribution shows how to call
other programs to gather the data.

-- 
Giorgos Keramidas, < keramida @ ceid . upatras . gr >
For my public PGP key: finger keramida@diogenis.ceid.upatras.gr
PGP fingerprint, phone and address in the headers of this message.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000203163029.A92577>