vnStat is a console-based network traffic monitor for Linux and BSD systems that can be used to keep track of network traffic usage. Here’s how to install vnStat on FreeBSD:
- Install vnStat using the package manager:
sudo pkg install vnstat
- Create the vnStat database and configure the default interface:
sudo vnstat -u -i re0
Replace “re0” with the name of your network interface.
- Start the vnStat daemon and enable it to start at boot:
sudo service vnstat start
sudo sysrc vnstat_enable=YES
- Verify that vnStat is running:
sudo service vnstat status
- To view the network traffic statistics, use the following command:
vnstat
By default, vnStat displays the traffic statistics for the last hour, day, week, month, and year. You can also use the “-h”, “-d”, “-w”, “-m”, and “-y” options to view the statistics for specific time periods.
For example, to view the hourly statistics for the last day:
vnstat -h
To view the daily statistics for the last week:
vnstat -d
To view the weekly statistics for the last month:
vnstat -w
To view the monthly statistics for the last year:
vnstat -m
To view the yearly statistics:
vnstat -y
With these steps, you should have vnStat installed and running on your FreeBSD system, and be able to monitor network traffic usage.