Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Monitoring Tools»How to Monitor Network Traffic with vnStat on CentOS and Fedora

    How to Monitor Network Traffic with vnStat on CentOS and Fedora

    By RahulFebruary 7, 20233 Mins Read

    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.

    Advertisement

    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

    1. Update the system’s package index by running the following command:
      sudo yum update 
      
    2. Install the vnStat package by running the following command:
      sudo yum install vnstat 
      
    3. Once the installation is complete, start the vnStat service by running the following command:
      sudo systemctl start vnstat 
      
    4. Enable the vnStat service to start automatically at boot time by running the following command:
      sudo systemctl enable vnstat 
      

    Step 2: Configuring vnStat

    1. To configure vnStat, open the configuration file using your favorite text editor, for example:
      sudo nano /etc/vnstat.conf 
      
    2. 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:

      1
      Interface "eth0"

    3. 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 
      
      Output
      Database 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.

    bandwidth bandwidth on network interface count bandwidth uses Linux bandwidth monitoring tool monitor bandwidth monitor network traffic vnstat vnstat php vnstat web interface
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Setting Up vnStat PHP Web Interface on CentOS and Fedora

    How to Install Nagios Client (NRPE) on Ubuntu 20.04

    Installing Nagios on Ubuntu

    How to Install Nagios Server on Ubuntu 20.04

    View 8 Comments

    8 Comments

    1. Arman on February 17, 2016 10:19 pm

      Thanks for the article, nicely done..

      Reply
    2. DatMan on December 19, 2014 9:21 am

      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

      Reply
    3. PurpleCookie on March 16, 2014 3:10 pm

      Nice, a simple easy to use network monitoring tool 🙂

      Reply
    4. site on January 13, 2014 12:21 pm

      Excellent, what a weblog it is! This website gives helpful data to
      us, keep it up.

      Reply
    5. independent.academia.edu on September 3, 2013 4:42 pm

      Hello, I enjoy reading through your article. I like to write a little
      comment to support you.

      Reply
    6. Francisco Torres on June 5, 2013 11:44 am

      Excellent, thank you very much from Chile 🙂

      Reply
    7. Sachin on May 11, 2013 4:45 am

      It is very helpful topic to me.Nice article.
      thanks

      Reply
    8. Nick on May 10, 2013 3:45 am

      Thanks a lot Admin, for sharing this with all of us you actually know what you are talking about!

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.