I often need to know how much bandwidth is my linux gateway/router box using, specially if there’s any P2P traffic (torrents) and from which IP address on the LAN is it coming. I was searching a lot for a suitable and preferably web based bandwidth monitoring tool, at the end I came up with a program called Bandwidthd that does data collection on it’s own (not SNMP) on the specified interfaces and subnets, and push them in dynamic html pages, with a top list of bandwidth users on your LAN network, what type of traffic are they using (http, p2p, ftp, etc) and apropriate graphs for all of the mentioned.
Initially, it’s not suited for a Centos box, but it’s installable. First, we need the development tools installed:
yum groupinstall ‘Development Tools’
Then a few more packages: libpcap – you can download it from here, then unpack, enter it’s folder, compile and install:
Another package you need is GD, it should be available from the standard repo:
yum install gd gd-devel php-gd
The third package is libpng, also should be available from the repo:
yum install libpng-devel After all the packages are installed, we can try to download the Bandwidthd code and try to compile it. Find the latest release from here, wget and uncompress it, enter it’s folder, and standardly compile it:
All should go smooth, without errors.
We have a few more steps to deploy. First we need to configure Bandwidthd:
make the options look something like this (there is an extensive explanation in the config file itself about the meaning of each):
subnet <the subnet you wish track>
subnet <if you have another subnet….>
skip intervals 0
Save and exit. BTW, you can add more subnets, as many as you like. And, under dev, you must enter the proper eth port that you want to use for traffic capture (usually the on on the LAN side) The only thing left is to add an alias for confortable use:
and add at least the line:
alias /bw /user/local/bandwidthd/httpdocs
Save, and exit. Now, start bandwidthd
You can add this line to rc.local to make it start on boot. At end, point your web browser to http://<server_ip_address or url>/bw Data should start comming in a few minutes.