How to Install and Use vnStat/vnStati for Real-Time Linux Network Monitoring
This guide explains what vnStat is, its key features, and provides step‑by‑step instructions for installing vnStat and vnStati on CentOS, RHEL, Fedora, Debian, and Ubuntu, configuring the service, and using the tools to monitor and graph network traffic on Linux systems.
What is vnStat?
vnStat is a console‑based network traffic monitor for Linux and BSD that records traffic statistics for selected network interfaces using information provided by the kernel. It does not sniff packets, consumes minimal system resources, and can run without root privileges.
Key Features
Statistics persist across reboots
Monitor multiple interfaces simultaneously
Various output formats
Data can be sorted by hour, day, month, or week, and you can retrieve the last 10 days
Generate PNG graphs
Configurable monthly billing cycles
Very lightweight – low CPU and memory usage
Root not required
Dynamic unit selection (KB, MB, …)
Options such as –nl/–nolegend, –altdate, –headertext
JSON output support
Automatic interface bandwidth detection
Installation
Download and extract
Download the latest release from the official GitHub page or with wget:
# wget https://humdi.net/vnstat/vnstat-2.6.tar.gzCentOS / RHEL / Fedora
# yum group install "Development Tools"
# yum install gd gd-devel sqlite-devel
# tar -xvf vnstat-2.6.tar.gz
# cd vnstat-2.6/
# ./configure --prefix=/usr --sysconfdir=/etc
# make
# make installDebian / Ubuntu
$ sudo apt-get install build-essential gd gd-devel libsqlite3-dev
$ tar -xvf vnstat-2.6.tar.gz
$ cd vnstat-2.6/
$ sudo ./configure --prefix=/usr --sysconfdir=/etc
$ sudo make
$ sudo make installSet up the service
Systemd:
# cp -v examples/systemd/vnstat.service /etc/systemd/system/
# systemctl enable vnstat
# systemctl start vnstatInit.d:
# cp -v examples/init.d/redhat/vnstat /etc/init.d/
# chkconfig vnstat on
# service vnstat startVerify installation
# vnstat
vnStat 2.6 by Teemu Toivola <tst at iki dot fi>Configuration
Edit /etc/vnstat.conf to adjust options such as interface selection, database update interval, and output preferences.
Basic usage
Display current statistics:
# vnstatHourly statistics:
# vnstat -hDaily statistics:
# vnstat -dShow all available options:
# vnstat --helpGenerating graphical reports with vnStati
vnStati is installed automatically with vnStat and can create PNG images of traffic data.
Example to generate a summary image for interface eth0:
# vnstati -s -i eth0 -o ~/network-log.pngHourly report:
# vnstati -h -i eth0 -o ~/network-log.pngThese tools provide valuable insight for monitoring, analyzing, and troubleshooting network usage on Linux systems.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
