How to use vnStat to monitor network traffic in Ubuntu 20.04

How to use vnStat to monitor network traffic in Ubuntu 20.04

Data is gathered and traffic on network interfaces is tracked by vnStat. So, with its assistance, we may learn the statistics of bandwidth utilization during a specific time period.

Installation of vnStat

The official Ubuntu 20.04 repositories contain vnStat. This lesson contains the most recent version as of the time of authoring. Let’s install after first updating the repository list:

$ sudo apt update
$ sudo apt install vnStat

Using the command: You can confirm that the installation was successful and determine the version

$ vnstat -v

Output:

vnStat 2.6 by Teemu Toivola

Checking if the service is active and has started analyzing traffic is as follows:

systemctl status vnstat
systemctl enable vnstat

Output:

vnstat.service - vnStat network traffic monitor
Loaded: loaded (/lib/systemd/system/vnstat.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-07-04 11:42:17 UTC; 39min ago

If enabled and active (running) are present, everything is in working order.

Utilizing vnStat to view network statistics

You must wait a time after installation for the statistics to assemble.

Run vnStat without parameters to see data for all time and for all network interfaces:

$ vnStat

Five-minute data are available here:

$ vnStat -5

For each hour:

$ vnStat -h

The bandwidth utilisation diagram will be constructed as follows:

$ vnStat -hg

Data for days, months, or years are as follows:

$ vnStat -d
$ vnStat -m
$ vnStat -y

The top 10 days by overall channel usage are displayed as follows:

$ vnStat -t

View 5-second summary statistics in real-time:

$ vnStat -tr

Thus, the utility will display what is occurring right now:

$ vnStat -l

You can choose one of your network interfaces if you have more than one by adding its name as an argument to the command:

$ vnStat -i interface name

Use the following syntax to stop tracking a specific interface and eliminate any associated statistics:

$ vnStat --remove -i interface name --force

Then, to add it back:

$ vnStat --add -i interface name

After adding, you must restart vnstat for the settings to take effect:

$ systemctl restart vnstat

As you can see, vnStat is a simple-to-use but effective tool for studying how network interfaces are used.

Follow us TwitterFacebookLinkedIn

Open Source Listing

Previous Post
Next Post

Leave a Reply