[olug] Bandwidth Metering

Charles Bird thebirdman at operamail.com
Thu Jun 8 16:37:20 UTC 2006


I was trying to use smoothwall but it was becoming a pain to get the thing to pass packets to the servers.

Now I am using slackware10.2 without alot of extras, its only using 38MB RAM :)
I have 385MB installed.

I am doing ipforward.
so here we go with my attempt of a text diagram....

[internet]<-->[cable modem]<-->[slackwarertr1]<-->[prolianthell]
Where slackwarertr has eth0 and eth1
Where proliant hell has a range of 16, perhaps soon 32+ IPs from cox. :)
I just want to make sure that someone isnt using 200GB upload a month on my 1Mb upload line.
I dont want to limit...I want to charge extra if they really need to do more.



> ----- Original Message -----
> From: "Mike Peterson Charles" <mpeterson at mail.charlesfurniture.com>
> To: "'Omaha Linux User Group'" <olug at olug.org>
> Subject: Re: [olug] Bandwidth Metering
> Date: Mon, 5 Jun 2006 21:22:13 -0500
> 
> 
> What distro are you using for this ""lil linux router that could"" ?
> 
> How many physical network cards are you using?
> 
> Are the IP addresses being passed thru to servers?
> 
> 
> -----Original Message-----
> From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf Of
> Charles Bird
> Sent: Monday, June 05, 2006 6:59 PM
> To: Omaha Linux User Group
> Subject: Re: [olug] Bandwidth Metering
> 
> aha, I was thinking about the same idea as Sam Tetherow has stated, but
> didnt know how to make it work.
> 
> But ya, basiclly i would like to have a record of usage for each IP address
> (currently 16 soon 32)
> yes route goes thru the "lil linux router that could"
> and into Proliant hell. :)
> 
> Thankyou guys for the input.
> 
> 
> 
> > ----- Original Message -----
> > From: "Sam Tetherow" <tetherow at shwisp.net>
> > To: "Omaha Linux User Group" <olug at olug.org>
> > Subject: Re: [olug] Bandwidth Metering
> > Date: Mon, 05 Jun 2006 18:28:07 -0500
> >
> >
> > This may not be the most elegant solution, but it's worked for me.
> > You'll want to rotate the log files every once in a while or date them
> > by setting $IPACCT_DIR to something meaningful like YYYYMM or YYYYMMDD.
> >
> > Hope it helps.
> >
> > For each IP to be monitored:
> >
> > iptables -A IPACCT -i $EXT -d IPADDR
> > iptables -A IPACCT -o $EXT -s IPADDR
> >
> > Where EXT is the external interface and IPADDR is the ip address to be
> > monitored
> >
> > Every 5 minutes run:
> > #!/usr/bin/perl
> > # This is a simple script that runs every 5 minutes and records how many
> > bytes have
> > # been sent and received foreach IP
> > # The output is appended to $IPACCT_DIR/$IPADDRESS
> >
> > $IPACCT_DIR="/var/log/ipacct";
> >
> > open(STREAM, '/sbin/iptables -L IPACCT -n -x -v -Z |');
> > $ts=time();
> > while(<STREAM>) {
> > if
> > (/^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s*$/)
> {
> > # Didn't use all the values, but you might want them.
> > my ($pkt, $bytes, $proto, $opt, $in, $out, $source, $destination)=($1,
> > $2, $3, $4, $5, $6, $7, $8);
> > if ($source eq "0.0.0.0/0") {
> > $downstream{$destination}=$bytes;
> > }
> > if ($destination eq "0.0.0.0/0") {
> > $upstream{$source}=$bytes;
> > }
> > }
> > }
> > foreach $ip (keys %downstream) {
> > # print "$ip\t$ts\t$downstream{$ip}/$upstream{$ip}\n";
> > open(LOG, ">>$IPACCT_DIR/$ip");
> > print LOG "$ts\t$downstream{$ip}\t$upstream{$ip}\n";
> > close(LOG);
> > }
> >
> >
> > Charles Bird wrote:
> > > anyone know of a good method of measuring bandwidth usage per 
> > IP > within a given time frame?
> > >
> > > Wondering who has done this and if there are recommendations from
> whomever.
> > > I am assuming this would be a lil linux router task. I am not > 
> > looking to shape or limit, just monitor usage per IP.
> > > Thx in advance.
> > >
> > >
> > >
> >
> >
> > --
> >     Sam Tetherow
> >     Sandhills Wireless
> >
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> 
> >
> 
> 
> --
> _______________________________________________
> Surf the Web in a faster, safer and easier way:
> Download Opera 8 at http://www.opera.com
> 
> Powered by Outblaze
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
> 
> 
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug

>


-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com

Powered by Outblaze



More information about the OLUG mailing list