vnStat is a network traffic monitoring tool for Linux systems. It is used to track the network traffic data and display it in a convenient graphical interface. vnStat can be used to track bandwidth usage on a per-interface basis, which makes it an ideal tool for monitoring network traffic on servers, routers, and other network devices. This article provides a comprehensive guide on how to set up vnStat on CentOS and Fedora systems.
Prerequisites
Before installing vnStat, make sure that your system meets the following requirements:
- A running CentOS or Fedora system
- A user with administrative or root privileges
Step 1: Installing vnStat
- Update the system’s package index by running the following command:
sudo yum update
- Install the vnStat package by running the following command:
sudo yum install vnstat
- Once the installation is complete, start the vnStat service by running the following command:
sudo systemctl start vnstat
- Enable the vnStat service to start automatically at boot time by running the following command:
sudo systemctl enable vnstat
Step 2: Configuring vnStat
- To configure vnStat, open the configuration file using your favorite text editor, for example:
sudo nano /etc/vnstat.conf
- In the configuration file, set the desired options, such as the location of the database file, the polling interval, and the interface to be monitored. For example, to monitor the “eth0” interface set the following option:1Interface "eth0"
- Save the changes and close the file.
Step 3: View Network Traffic Statistics
You should wait for some time to let the vnStat collect data for the defined interface. After that, you can view the statics on the command line interface.
- To check the network traffic data, run the following command:
vnstat
OutputDatabase updated: 2023-02-07 18:30:00 eth0 since 2023-02-07 rx: 686.41 KiB tx: 5.20 MiB total: 5.87 MiB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- 2023-02 686.41 KiB | 5.20 MiB | 5.87 MiB | 84 bit/s ------------------------+-------------+-------------+--------------- estimated 2.31 MiB | 20.76 MiB | 23.07 MiB | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- today 686.41 KiB | 5.20 MiB | 5.87 MiB | 739 bit/s ------------------------+-------------+-------------+--------------- estimated 890 KiB | 6.74 MiB | 7.61 MiB |The vnStat output will display the network traffic data for the specified interface in a graphical format, including the total amount of data received and transmitted, the total number of packets received and transmitted, and the average transfer rate.
- You can also view the statistics for a specific time period, such as daily, weekly, monthly, and yearly, by running the following command:
vnstat -d
vnstat -w
vnstat -m
vnstat -y
- You can also view the network statics in real-time with the following command.
vnstat -l
Conclusions
vnStat is a simple and lightweight tool for monitoring network traffic on Linux systems. With the help of this article, you should now be able to install and configure vnStat on CentOS and Fedora systems. The tool is highly customizable and provides a graphical representation of network traffic data, making it easy to understand and analyze network usage patterns. With vnStat, you can monitor network traffic on servers, routers, and other network devices, and ensure that your network is running smoothly.
8 Comments
Thanks for the article, nicely done..
Hi Folks ,
Thank you for amazing pretty tool article.
i have a question.
i installed my centos 6 x64 cPanel WHM server but . Getting Internal Server Error
But everythings looks normal.
What can i do ?
Thanks in advance.
Regards.
Berk
Nice, a simple easy to use network monitoring tool 🙂
Excellent, what a weblog it is! This website gives helpful data to
us, keep it up.
Hello, I enjoy reading through your article. I like to write a little
comment to support you.
Excellent, thank you very much from Chile 🙂
It is very helpful topic to me.Nice article.
thanks
Thanks a lot Admin, for sharing this with all of us you actually know what you are talking about!