vnStat is a network traffic monitor for Linux that keeps a log of daily network traffic for the selected interface(s). vnStat isn’t a packet sniffer. The traffic information is analyzed from the /proc filesystem. That way vnStat can be used even without root permissions
1) Download the source - here
2) Untar - # tar -zxvf vnstat-1.6.tar.gz
3) Compile/Install the source
# make install
4) To create a database for vnstat type in vnstat -u -i interface (ie, eth1), after the database is created, which is the first thing to do after a fresh install of vnstat, allow some time for the database to populate with information. After some time just type in vnstat to get a summary of your daily traffic. The database is stored in a file in the /var/lib/vnstat/ directory in a small binary file, you can sets up a cron job that refreshes the bandwidth consumption data on the eth0 port every five minutes
If you're not satisfied with the appearance of vnStat's command-line interface, you can install 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.
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:
# mkdir /var/www/vnstat
# tar -zxvf vnstat_php_frontend-1.4.tar.gz -C /var/www/vnstat/
# chown -R www-data.www-data /var/www/vnstat
Launch your browser and visit the vnStat page at http://localhost/vnstat to see something like ...