vnstat is free and open-source software. It is a console-based network traffic monitor that keeps a log of daily network traffic for the selected network interface. It is not a packet sniffer. The traffic information gathered from the /proc file-system so that application can use without root user-level access. This page shows how to install vnstat on Fedora Linux desktop or server.
1. Find information about vnstat
Run the following dnf command:
dnf update
dnf info vnstat
2. Fedora Linux install vnstat app
Simply run the following command to install vnstat on Fedora Linux:
sudo dnf install vnstat
How to install vnstat on Fedora Linux
3. Configure the vnstat
You need to edit the file named /etc/vnstat.conf using a text editor such as vim/nano:
sudo vi /etc/vnstat.conf
Set default interface name (use the ip command to obtain interface name):
Interface "wlp1s0"
Save and close the file in vim/vi.
Enable the service
Type the following systemctl command:
sudo systemctl enable vnstat.service
Sample outputs:
Created symlink /etc/systemd/system/vnstatd.service ? /usr/lib/systemd/system/vnstat.service. Created symlink /etc/systemd/system/multi-user.target.wants/vnstat.service ? /usr/lib/systemd/system/vnstat.service.
Start the service
sudo systemctl start vnstat.service
Stop the service
sudo systemctl stop vnstat.service
Restart the service
sudo systemctl restart vnstat.service
Find status of the vnstat service
sudo systemctl status vnstat.service
4. Learn how to use vnstat
The syntax is as follows:
vnstat
vnstat -i NIC_NAME
vnstat [options] -i NIC_NAME
Let us see some examples by typing the following command:
vnstat
vnstat -i eth0
Sample outputs:
Database updated: Thu Jul 11 17:00:51 2019 eth0 since 06/11/17 rx: 796.74 TiB tx: 86.08 TiB total: 882.81 TiB monthly rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- Jun '19 29.50 GiB | 2.84 GiB | 32.33 GiB | 104.64 kbit/s Jul '19 11.95 GiB | 1.05 GiB | 13.00 GiB | 117.89 kbit/s ------------------------+-------------+-------------+--------------- estimated 34.59 GiB | 3.04 GiB | 37.63 GiB | daily rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- yesterday 1.82 GiB | 172.14 MiB | 1.99 GiB | 193.09 kbit/s today 901.73 MiB | 92.55 MiB | 994.28 MiB | 132.98 kbit/s ------------------------+-------------+-------------+--------------- estimated 1.24 GiB | 129 MiB | 1.37 GiB |
One can display traffic summary for a merge of interfaces eth0, eth3 and eth7:
vnstat -i eth0+eth3+eth7
Want to see information about interface eth9 in xml format? Try:
vnstat -i eth0 --xml
How about see all information of all monitored interfaces in json format? Try:
vnstat --json
vnstat --json -i eth0
Display hours stats
vnstat -h
Show traffic statistics on a hourly basis for the last 24 hours
Daily bandwidth usage stats
vnstat -d
See traffic statistics on a daily basis for the last 30 days
Weekly bandwidth usage stats
vnstat -w
Get network traffic for 7 days, current and previous week
Monthly network usage stats
vnstat -m
My traffic statistics on a monthly basis for the last 12 months
Get top 10 bandwidth usage days
vnstat -t
Find all time top 10 traffic days
Monitor network transfer rate in real time
vnstat -l
Gif 01: vnstat live in action
Force a database update for interface eth0
vnstat -u -i eth0
Delete database of interface eth1 and stop monitoring it
vnstat -i eth1 --delete
Conclusion
This page showed you how to install and use vnStat which a console-based network traffic monitor for Linux that keeps a log of network traffic for the selected interface(s). For more info, see project home page here.
- How to install vnstat on a CentOS/RHEL/Fedora Linux
- View Vnstat Graphs Using PHP Web Interface Frontend
- How to install vnstat on FreeBSD Unix server
- Fedora Linux install vnstat network traffic monitor
- Ubuntu install vnstat console network traffic monitor
🐧 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |