Select Page

ABIOLA RASP – Raspberries for African School Projects

Wie können wir helfen?

< Alle Themen

Network Traffic Monitor – vnstat

no-272 au-03

What is vnstat command?

vnstat command is a console-based traffic monitor. It keeps a log of network traffic in a database and you can reach that information by using vnstat command. Let’s install the vnstat package and check the network traffic.

Install vnstat

Please follow below instructions to install vnstat after open your terminal.

1. Update the package lists

sudo apt-get update

2. Install vnstat

sudo apt-get install vnstat

Monitor the network traffic

The most basic usage of vnstat gives the summary of total network traffic from all interfaces.

1. Run below command


2. wlan0 interface (Wireless network interface)
3. Received data from network
4. Transmitted data to network
5. Total data (received data + transmitted data)
6. Date of network traffic
7. eth0 interface. (There is a warning message here becasue I use wireless network for my Raspberry Pi. I don’t connect internet with ethernet cable.)

Monitor the specific network interface

You must use -i option with your interface name which you want to monitor. I’ll monitor the wlan0 interface. Please check the example below.

1. Run below command to monitor the wlan0 interface

vnstat -i wlan0

You must replace wlan0 with eth0 to monitor eth0 interface.

2. This section is the montly network trafic. You can see the recevied and transmitted data.
3. At this section there is daily network traffic.

Monitor only monthly data traffic

You must use -m option to monitor monthly network traffic. Let’s look at the example.

1. Run below command to monitor wlan0 interface monthly

vnstat -m -i wlan0

-m option is used for monthly
-w option is used for weekly
-h option is used for hourly

Live monitoring

There is also an option to make live monitoring.

1. Run below command for live monitoring

vnstat -l -i wlan0

2. Here is the live network traffic
3. Press CTRL + C to stop live monitoring