Knowing how much traffic your server actually moves is essential for capacity planning, detecting abuse and avoiding surprise bandwidth bills. Real-time dashboards are great, but they forget everything when the process restarts. This is where vnStat bandwidth monitoring shines: vnStat is a lightweight, kernel-based network traffic monitor for Linux that keeps a persistent database of hourly, daily and monthly traffic per interface, using almost no CPU or memory. In this guide you will install vnStat, read its reports and use its data like a sysadmin.
Why Use vnStat Bandwidth Monitoring? – How to Monitor Network Bandwidth with
Unlike tools that capture packets, vnStat reads the counters the kernel already maintains for each network interface and stores summaries in its own database. That gives it several advantages:
- Statistics survive reboots and service restarts
- No promiscuous mode and no packet sniffing, so it works on any interface
- Extremely low resource usage, safe for small VPS instances
- Built-in hourly, daily, monthly and top-days reports plus live mode
vnStat complements a real-time dashboard such as Netdata for real-time Linux monitoring: Netdata shows what is happening right now, while vnStat answers how much data you transferred this month.
Step 1: Install vnStat – How to Monitor Network Bandwidth with
vnStat is available in the repositories of every major distribution:
# Ubuntu / Debian
sudo apt update
sudo apt install -y vnstat
# RHEL / AlmaLinux / Rocky (EPEL required)
sudo dnf install -y epel-release
sudo dnf install -y vnstat
Start and enable the daemon so it begins collecting data:
sudo systemctl enable --now vnstat
systemctl status vnstat
On Debian-family systems the service is sometimes named vnstat as well; older releases used a SysV init script but still start automatically after installation.
Step 2: Check Which Interfaces Are Monitored
List the interfaces vnStat knows about:
vnstat --iflist
By default vnStat monitors all available interfaces except loopback. If an interface (for example a newly added eth1) is missing, add it explicitly:
sudo vnstat --add -i eth1
sudo systemctl restart vnstat
Wait at least five minutes after installation before judging the output: vnStat needs a couple of collection cycles before its database contains meaningful values, and brand-new interfaces will first display zeros.

Step 3: Read vnStat Bandwidth Monitoring Reports
The default report shows a summary for the current interface:
vnstat
For the reports you will use most often in day-to-day administration, vnStat provides dedicated modes:
vnstat -h # hourly traffic for the last 24 hours
vnstat -d # daily traffic for the last 30 days
vnstat -m # monthly traffic for the last 12 months
vnstat -t # top 10 traffic days of all time
vnstat -l # live traffic, refreshing in real time
To query a specific interface, add the -i flag:
vnstat -i eth0 -m
A typical monthly report shows received (rx), transmitted (tx) and total traffic plus an estimated projection for the current month. That estimate is the number to compare against your hosting plan’s bandwidth quota before the month ends.
Step 4: Generate a Traffic Graph and JSON Output
If the vnstati package is installed, you can render PNG summaries that are easy to attach to reports:
sudo apt install -y vnstati
vnstati -s -i eth0 -o /tmp/vnstat-summary.png
vnstati -m -i eth0 -o /tmp/vnstat-monthly.png
For scripting and alerting, vnStat can dump everything as JSON, which pairs nicely with tools like jq:
vnstat --json | jq '.interfaces[0].traffic.month'
You can use this in a cron job to warn you when monthly traffic crosses, say, 80 percent of your quota — the same automation approach we used to automate Linux backups with rsync and cron.
Troubleshooting
“Not enough data available yet”: vnStat has not collected two full update cycles. Wait a few minutes and check that the daemon is running with systemctl status vnstat.
Values reset or look too low: the interface counters on some virtual NICs reset when the interface is recreated. Make sure the interface name in /etc/vnstat.conf matches the real device, and check the database directory permissions on /var/lib/vnstat.
Wrong default interface: set Interface "eth0" in /etc/vnstat.conf and restart the service. The official vnStat website documents every configuration option and report mode.
Step 5: Review vnStat Data in Your Weekly Routine
Make the monthly report part of your server housekeeping. Once a week, run vnstat -m on each VPS and compare the estimate column against your plan. A sudden jump in transmitted traffic (tx) on a server that should mostly serve downloads can indicate a compromised account relaying spam or a runaway backup job uploading far more than expected. Because vnStat keeps its own long-term database, you can spot these trends months later — long after a real-time dashboard would have forgotten them. On servers with several interfaces, such as a public NIC plus a private backup network, reviewing both interfaces separately tells you whether backup traffic is correctly staying on the private, unmetered link.
Conclusion
With vnStat bandwidth monitoring in place, you always know how much traffic each interface has moved — per hour, per day and per month — without running a heavy monitoring stack. Install it on every VPS you manage, review the monthly estimate weekly, and you will never be surprised by an overage invoice or an abusive process saturating your link again.