• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Track Bandwidth On Linux Using vnStat

How VPS by How VPS
January 1, 2020
in Linux
0
How to Use ‘cat’ and ‘tac’ Commands with Examples in Linux
0
SHARES
26
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Installing
  2. Configuration for yum/manual installs
  3. Configuring vnStat options
  4. Usage
  5. Want to contribute?


vnStat is a comprehensive package for Linux operating systems used to track and monitor bandwidth usage. It is included in the default repositories of most package managers.

This tutorial will teach you how to install, configure, and view the output from vnStat.

Installing

vnStat has packages in most popular package managers. Use the snippet below relevant for your system, or compile the program from its source code.

Ubuntu/Debian

$ apt-get install vnstat

CentOS/Fedora

$ yum install vnstat

Compiling from source

Grab the latest version of vnStat from the official site.

$ wget http://humdi.net/vnstat/vnstat-1.14.tar.gz

Once the file has downloaded, extract it and execute the following commands.

$ tar -xvf vnstat-1.13.tar.gz
$ cd vnstat-1.13/
$ make

Once this completes, install it using the command below.

$ make install

Configuration for yum/manual installs

Skip this section if you installed vnStat using apt-get.

If you installed directly from source or using yum, you will have to specify the adapter(s) that you want monitored. This is all configured automatically when installed using apt-get.

Run the following command to view all available interfaces that vnStat can monitor.

$ vnstat --iflist

To log traffic for the default interface on yum/manual installations, execute the following command. This also creates the database for the adapter.

$ vnstat -u -i eth0

Next, start the vnStat daemon using the command:

$ vnstatd -d 

You can also add this command to your /etc/rc.local file, so that it starts automatically when your system boots.

Configuring vnStat options

You can edit the vnStat config file located at /etc/vnstat.conf to customize the options to your preference. Use a text editor to open and edit the file.

$ nano /etc/vnstat.conf

If you prefer bandwidth stats to be output in KB/MB/GB/TB format instead of the default KiB/MiB/GiB/TiB format, change UnitMode 0 to UnitMode 1, and you may also change RateUnit 1 to RateUnit 0 to display the rates in bytes.

You should also change the maximum bandwidth to that of the port on your VPS (1 GiB or 10 GiB). Change MaxBandwidth 100 to MaxBandwidth 1000 (for 1GiB port) or MaxBandwidth 10000 (for 10GiB port)

Track Bandwidth On Linux Using vnStat

Save and exit the file.

Usage

To see a quick summary of the traffic consumed, use the bare command vnstat.

root@vultr:~# vnstat
Database updated: Sun Dec 13 04:56:02 2015

   eth0 since 12/13/2015

          rx:  225 KB      tx:  229 KB      total:  454 KB

   monthly
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
       Dec '15        225 KB |      229 KB |      454 KB |      0.00 KB/s
     ------------------------+-------------+-------------+---------------
     estimated        --     |      --     |      --     |

   daily
                     rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
         today        225 KB |      229 KB |      454 KB |      0.03 KB/s
     ------------------------+-------------+-------------+---------------
     estimated        --     |      --     |      --     |

To get more specific data, you can use the vnstat -m and vnstat -d commands for month and day level output, respectively.

root@vultr:~# vnstat -m

 eth0  /  monthly

       month        rx      |     tx      |    total    |   avg. rate
    ------------------------+-------------+-------------+---------------
      Dec '15        225 KB |      229 KB |      454 KB |      0.00 KB/s
    ------------------------+-------------+-------------+---------------
    estimated        --     |      --     |      --     |

root@vultr:~# vnstat -d

 eth0  /  daily

         day         rx      |     tx      |    total    |   avg. rate
     ------------------------+-------------+-------------+---------------
     12/13/2015       225 KB |      229 KB |      454 KB |      0.03 KB/s
     ------------------------+-------------+-------------+---------------
     estimated        --     |      --     |      --     |

You can also display live traffic statistics using the command vnstat -l.

root@vultr:~# vnstat -l
Monitoring eth0...    (press CTRL-C to stop)

   rx:       0.03 KB/s     0 p/s          tx:       0.19 KB/s     0 p/s

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

Create an HTML 5 RDP/SSH Frontend Using Guacamole on Ubuntu 16.04 LTS

Next Post

How to Install Open Eshop on Ubuntu 16.04

Next Post

How to Install Open Eshop on Ubuntu 16.04

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet