How to Monitor Internet Traffic on Linux VPS - Evoxt
Login
Register
We care about the Environment

How to Monitor Internet Traffic on Linux VPS

If you want to monitor your Linux VPS's internet traffic, vnStat is a lightweight and efficient tool for tracking network bandwidth without slowing down your system. Whether you’re hosting on Evoxt VPS or another provider, this guide shows you how to set up vnStat, view monthly usage, and configure custom billing cycles.

What is vnStat and Why Monitor Traffic on Your Linux VPS?

vnStat is a console-based network traffic monitor that records incoming and outgoing data per interface. It’s ideal for VPS owners who want to:

  • Track monthly bandwidth usage per interface.
  • Monitor data consumption over time for accurate billing and performance monitoring.
  • Detect abnormal traffic or possible misuse.

Unlike packet-capture tools, vnStat doesn’t impact performance. It simply reads statistics from the Linux kernel network counters, making it suitable for any VPS running Ubuntu, Debian, AlmaLinux, Rocky, or RHEL.

Step 1: Install & enable vnStat

# Debian / Ubuntu
sudo apt install vnstat -y

# RHEL-based (AlmaLinux / Rocky / RHEL)
sudo dnf install vnstat -y

# Enable and check the service (daemon creates DB automatically)
sudo systemctl enable --now vnstat
sudo systemctl status vnstat

Step 2: View monthly usage

# Monthly summary
vnstat -m

#To select interface
vnstat -m -i eth0

# Daily / hourly if needed
vnstat -d
vnstat -h

Example output will display received (rx), transmitted (tx), and total data per month.

Step 3: Set custom monthly rotation date (match billing cycle)

To reset monthly counters on a date other than the 1st, edit vnStat’s config and set MonthRotate:
sudo nano /etc/vnstat.conf
MonthRotate 18

After editing, restart the service to apply:
sudo systemctl restart vnstat
With MonthRotate 18, vnStat treats the statistics window as “billing months” that end on the 18th and reset on the 19th.

Optional: Reset or delete statistics

# remove DB for an interface (example: eth0)
sudo vnstat --remove --force -i eth0
sudo vnstat --add -i eth0

# OR delete DB file directly
sudo rm -f /var/lib/vnstat/vnstat.db

sudo systemctl restart vnstat

Quick Commands

# Install & enable

sudo apt install vnstat -y    #Debian / Ubuntu 
sudo dnf install vnstat -y    # RHEL-based (AlmaLinux / Rocky / RHEL) 
sudo systemctl enable --now vnstat

# Result
vnstat

# Change monthly rotate date
sudo nano /etc/vnstat.conf

MonthRotate 10

sudo systemctl restart vnstat

Conclusion

Using vnStat to monitor monthly internet traffic on your Linux VPS helps you understand bandwidth usage, avoid unexpected overages, and identify abnormal traffic.

If you see unexpected usage after enabling vnStat, check for open services, review firewall rules, or open a support ticket with Evoxt for assistance.

For more Evoxt VPS guides, visit Evoxt Tutorials.

High CPU Frequency Virtual Machines

Available Globally

Starting at

$2.99

Deploy now