We all live in a world surrounded by networks. The most important among them, and no doubt in that, is internet technology. When we relate networks to the computer systems, it is GNU/Linux dominating this particular field (again no doubt). Organizations working under computer networks usually run on GNU/Linux environment. So there is a great need for monitoring the network traffic. vnStat arrives in such a situation rendering a great help towards the network world. It is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). vnStat can be used even without root permission on most systems. It will be helpful for some of you for accounting the amount of data being transfered from our system to the outside world. I will brief some basic command-line options to start with. Install the utility from your distro’s default package manager.
The basic format for vnStat is
For creating a new database for a particular interface
sudo vnstat -u -i <interface>
Ex:- sudo vnstat -u -i eth0
Now inorder to get the details after the data transfer run
sudo vnstat -u -i eth0 and then
vnstat -i eth0
Output displays data transfer amount, rate etc on hourly, daily, weekly, monthly basis. -h for hours, -d for days,-w for weeks -m for months. -u option is used to update the database and -i for specifying the interface. In order to delete and stop monitoring an interface use
sudo vnstat –delete –force -i <interface>
I think it is enough for all to play around with vnStat. More details will be available to you after installing the package through the man page, as usual.
2 thoughts on “vnStat for monitoring network traffic through interfaces”
can u explain the columns that appeared
I think it is pretty clear from the screenshot attached along with the post.
Basic invocation of vnstat command without any special arguments will list the days ( hours or weeks or months) as the first column, then the amount of received data, transmitted data, total data and the average data transfer rate.
-d option is for running vnstat in background and -i is for specifying the network interface name. For better explanation about various arguments, see the man page for vnstat.