Lingkage program

Bandwidth Monitoring with vnStat

Posted on: June 18, 2007

If you want to monitor and manage your Internet bandwidth, perhaps to make sure your ISP is not overbilling you, try vnStat, an open source, Linux-based application that gives you a clear picture of your bandwidth usage. This command-line application is simple to install and easy to use.

document.write(”); dfp_tile++;

‘,’336′,’280′,’1′,’1′,288474,170230,’0′,’426′,0,undefined,0,0);” onmouseout=”if(typeof(prRoll)==’function’)prBExit(event);” />

VnStat offers binary packages for the Debian distribution on its site, and Dag Wieers’ RPM repository has RPMs for various Red Hat-based distributions. Of course, you can also compile vnStat from the source files available from the project’s home page. I tested vnStat on an Ubuntu Edgy desktop; to install the software, I ran sudo apt-get install vnstat.

The first step in using vnStat is to initialize it and configure it to read your Internet bandwidth usage. Since I connect to my network using the eth0 port, I ran the command sudo vnstat -u -i eth0 to initialize the vnStat database. The database is stored in a file in the /var/lib/vnstat/ directory in a small binary file.

vnStat CLI  
Click to enlarge

During installation vnStat sets up a cron job that refreshes the bandwidth consumption data on the eth0 port every five minutes. After letting the program run for a few minutes, type vnstat with no arguments. Like magic you’ll see something like this:

You can display your data in hourly, daily, or monthly increments using the -h, -d, and -m arguments. If you need to know more, the only documentation available is the man page and a FAQ at the project’s home page.

If you’re not satisfied with the appearance of vnStat’s command-line interface, you can install Bjorge Dijkstra’s PHP-based Web front end for vnStat, which takes the data collected by the command-line vnStat and displays it in tables and graphically in your browser. The front end requires a Web server configured with PHP.

vnStat GUI  
vnStat GUI – click to enlarge

Download the tarball, extract the files into a subdirectory of your Web server’s document root directory — most likely /var/www/ or /var/www/html — and give it the right permissions so the Web server can write to it:

# sudo mkdir /var/www/vnstat
# sudo tar -zxvf /home/justforkix/vnstat_php_frontend-1.2.1.tar.gz -C /var/www/vnstat/
# sudo -R chown www-data.www-data /var/www/vnstat
Launch your browser and visit the vnStat page at http://localhost/vnstat. To check out the fancy graphs, click on the “hourly” link associated with your Internet connection. The graphs are simple and straightforward, and you cannot customize them.

In just a few minutes, vnStat can help you start keeping track of your network bandwidth usage.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


  • None
  • Order Xtrasize: Hi there, all is going well here and ofcourse every one is sharing facts, that's in fact fine, keep up writing.
  • chatroulette: I am curious to find out what blog system you're using? I'm experiencing some small security issues with my latest site and I would like to find s
  • 3:00 AM: Hello! Do you know if they make any plugins to protect against hackers? I'm kinda paranoid about losing everything I've worked hard on. Any suggest


%d bloggers like this: