VnStat is a console-based network traffic monitor that can be used to track network traffic on Linux systems. To install VnStat on Ubuntu 20.04 LTS, you can use the following steps:
- Update the package list by running the command:
sudo apt update
- Install VnStat by running the command:
sudo apt install vnstat
- Once the installation is complete, you can start the VnStat daemon by running the command:
sudo systemctl start vnstat
- To ensure that VnStat starts automatically on boot, you can enable it by running the command:
sudo systemctl enable vnstat
- To check the status of the VnStat daemon, you can run the command:
sudo systemctl status vnstat
- To create the database for VnStat to monitor traffic on an interface, you can use the command :
sudo vnstat -u -i <interface>
Replace <interface> with the name of the interface you want to monitor, you can find the interface name by running the command “ip addr show”
- Once the database is created, you can view the network traffic statistics by running the command:
vnstat
- You can also view the statistics for a specific interface by running the command:
vnstat -i <interface>
- To view the statistics for a specific time period, you can use the command:
vnstat -d | -m | -t | -w | -h
You can also use vnstati to create image output of vnStat data, it is a tool to create PNG images out of vnStat data.
It’s important to note that VnStat is a console-based tool, it doesn’t have a web interface like other network traffic monitoring tools. However, it is lightweight and easy to use, and it provides a quick and simple way to monitor network traffic on your Ubuntu system.