Operations 7 min read

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.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
How to Install and Use vnStat/vnStati for Real-Time Linux Network Monitoring

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.gz

CentOS / 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 install

Debian / 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 install

Set up the service

Systemd:

# cp -v examples/systemd/vnstat.service /etc/systemd/system/
# systemctl enable vnstat
# systemctl start vnstat

Init.d:

# cp -v examples/init.d/redhat/vnstat /etc/init.d/
# chkconfig vnstat on
# service vnstat start

Verify 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:

# vnstat

Hourly statistics:

# vnstat -h

Daily statistics:

# vnstat -d

Show all available options:

# vnstat --help

Generating 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.png

Hourly report:

# vnstati -h -i eth0 -o ~/network-log.png

These tools provide valuable insight for monitoring, analyzing, and troubleshooting network usage on Linux systems.

LinuxSystem AdministrationNetwork MonitoringTraffic analysisvnstatvnstati
MaGe Linux Operations
Written by

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.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.