How to use bmon to monitor network bandwidth on linux

Knowing how you use your network is an important asset. However, this easier said than done, as you will need to assess several components of the network. While this is a complex task, having a clear picture of bandwidth usage is simple. Today, we see how to use bmon to project real-time charts of your network usage in Linux. This is similar to what you see in the task manager on Windows, just more powerful.

What is bmon?

Bmon is a free tool that allows you to plot your network statistics on-screen. It works in the terminal and creates nice charts of your bandwidth, real-time. Thus, it is a great tool when it comes to troubleshooting network problems. Besides merely learning how to use it, we will also see some common use cases.

Getting bmon

Use your package manager to get bmon, it is just a single package. For example, on Ubuntu we used sudo apt-get install bmon . You can also use yum on the Red Hat family, or dnf on Fedora 22+. This will install bmon, and now you can simply run it by typing bmon. However, before we do that, it is better to generate some traffic to grow our bandwidth usage.

How to use bmon

Create some traffic

This step is optional but recommended. You don’t want to see a flat chart, right? Thus, we first need to generate some network traffic. You can go the easy route, watching a video on YouTube, or downloading something. However, this is not always possible, not to mention it isn’t professional. Instead, you can opt for a bandwidth test software like iperf. This tool allows you to generate traffic according to your specifications, and you can install it as quick as sudo apt-get install iperf3 .

Then, you can run iperf3 -s on a terminal, and iperf3 -c localhost -t 100 on another terminal to test connection to the loopback interface for 100 seconds. This is probably the shortest explanation of iperf you could find, but if you want to learn more we got you covered. Just check our iperf3 tutorial.

Reading bmon charts

Once you have some traffic going, open a terminal (yet another if you were using iperf3) and type bmon . You will see something like this:

How to use bmon to monitor network bandwidth on linux

Bmon charts.

As you can see, we have a main area in the center showing two charts: the bandwidth received (RX, in green), and the bandwidth transmitted (TX, in red). Just above that, we have three boxes:

  • In the interfaces box, you can select which network interface to see the charts for. You can scroll using up and down arrows. In this example, we are watching charts for the loopback interface ( lo ).
  • The next box gives you information about the received traffic (RX). You see the received traffic for all interfaces in bits per second and packets per second.
  • Finally, the rightmost box shows the same information about the RX box, but for transmitted traffic (TX).

You can also see additional information by pressing d , or add more charts with < . You can remove the charts you added with > . Additional charts will show information about errors, collisions, and other network problems. Since we are testing a loopback, we don’t expect any.

How to use bmon to monitor network bandwidth on linux

Bmon charts with more information, including errors.

Once you are done, you can quit by pressing q .

Summary

Bmon is a powerful tool in the Linux prompt to monitor bandwidth usage and errors. Install the bmon package with your package manager, then simply run bmon . Use d , < and > to show or hide information and charts, up and down arrow to select the interface to see charts for. To quit, just hit q .

With bmon in your toolkit, you are ready to do the nasty troubleshooting sometimes required to network engineers. Try it and let me know what do you think about this simple, yet awesome, software.

Maintaining a network also means maintaining its bandwidth. Bandwidth leak will lead the network users to complain and may impact to slow response from applications. On Linux system, we can use a tool called bmon to monitor the bandwidth in real-time.

What is bmon

Bmon or Bandwidth Monitoring is a tool that intended for debugging and monitor bandwidth in real-time access. This tool is capable to retrieving statistics from various input modules. It provides various output methods including a curses-based interface.

Installation

On my Zorin OS which based on Ubuntu 13.04, I can install it by typing :

This will install bmon instantly. But bmon version on this Ubuntu 13.04 is 2.0.103. While the latest version at the time this article is written is version 3.1.

In this article, we will use the latest version. This version only available in tar.gz format. Here are the steps to install it.

1. Download the latest version from Carisma website

2. Extract it

3. Go to the extracted folder

4. Compile and install bmon

Error messages :

If you have some errors that we had, this may help you.

Please note that we are using Ubuntu-based distribution. This steps might be different with other Linux distribution.

No CONFUSE library

To solve this error, install libconfuse library.

No LIBNL library

To solve those errors, install LIBNL library.

More detail about LIBNL library can be found at bmon website: http://www.carisma.slowglass.com/

Run bmon

After bmon installed, we can run bmon by typing bmon in the terminal.

How to use bmon to monitor network bandwidth on linux

With no option, bmon will run in default curses mode. Bmon graph is divided into some parts.

  • The first row shows us the available interfaces, receive transmit and transfer transmit. This rows is represented by l letter which mean list view.
  • The second row is graphical statistics. If the graph is not showing, you can press g button.
  • The third row shows us the detailed statistics of receive and transfer activity.
  • And the fourth row shows us the additional information.

To get some help on how to operate bmon, press question mark button (?).

How to use bmon to monitor network bandwidth on linux

We also can run bmon with options. Here are some options for bmon.

Set input modules

bmon has some input modules. There are netlink, proc, dummy and null.
To define it by yourself, we can use -i option. For example, if we want to use input from /proc/net/dev file, we can type :

Set output modules

bmon has some output modules. There are curses, ascii, format and null. By default, bmon will use curses as the output. If we want to use ascii output, we can type :

To get help about ascii modules, type :

How to use bmon to monitor network bandwidth on linux

Set specific interface to display

To do this, we can use -p option.

With this option, bmon will only list the eth0 interface. If you put eth*, then will list all interface with pattern eth0, eth1 until ethX.

How to use bmon to monitor network bandwidth on linux

Set read interval

By default, bmon will statistics every 1 seconds. If we want to change it, we can use -r option. Say we want to change it into 10 seconds, we can run bmon with :

Conclusion

bmon can be a handy tool for debugging and monitor bandwidth in realtime mode. This program is light and easy to use. As usual, we can always type man bmon or bmon –help to display its manual page and explore it more detail.

How to use bmon to monitor network bandwidth on linux

In a past article we discussed running an internet speed test from the Linux command line. That is great for testing your internet speeds. But, what if you wanted to monitor the bandwidth usage of an internal connection? Enter bmon, a light weight real-time command line bandwidth monitoring tool.

The bmon utility is a tool that provides network interface utilization information on the command line, but in a very familiar way. The bmon utility is widely available, simple to install, and easy to get started. Let’s dive in.

In this view you there are several rows (panes) of data.

1st row: This is the element list which shows all the interfaces that you can monitor and their current RX/TX utilization. You can use the up and down arrows to navigate to the desired interface.

2nd row: A graphical representation of the interface attributes. By default it shows the RX (received) and TX (transmitted) packets. The graphs can be toggled on or off by hitting g . Additionally, you can use the left and right arrows to toggle the attribute to be displayed.

3rd row: The detailed statistics pane. It shows you all the detailed information your system keeps on the selected network interface. You can toggle the detailed statistics by hitting the d key.

4th row: This is the additional information pane and shows you some more information about the configuration of the interface. You can toggle this on or off by hitting the i key.

At any time you can hit the ? to bring up the quick reference (seen below).

How to use bmon to monitor network bandwidth on linux

To exit the interface you can hit the q key.

Using BMON Options

There are several options and input/output modules that really make bmon a robust bandwidth monitoring utility. In this section we will outline some of the most common options.

Use Specific Interface at Start Up

You most likely want to monitor a specific interface when you open the utility. Instead of toggling through to find the interface you want, you can use the -p option and specify it on the command line. Here we are telling bmon to monitor the eno1 interface.

Set User Defined Read Interval

The default update, or read, interval is one second. You can change this to whatever you desire. Simply pass the -r switch followed by the desired interval in seconds. For example, to use a five second read interval, the command would look like this:

You can decimal representations for half intervals or intervals less than a second. For example, use .5 to update the interface every half second.

Set User Defined Rate Interval

The rate interval is the time period in seconds taken into account for the rate calculations. The default value is 30 seconds. You can set a custom rate interval by using the -R option like so:

Show All, Including Disabled, Interfaces

Using the -a option will show all elements (interfaces), including those that are disabled.

Using BMON Input and Output Modules

The bmon utility comes with several pre-configured input and output modules.

Listing Available Modules

You can list the available modules by calling the -i (input) and -o (output) options followed by the list argument.

Modules Descriptions

Here is a brief description of each module.

Input Modules

  • netlink – Provides stats about traffic control qdiscs and classes.
  • proc – Provides stats using the proc filesystem.
  • dummy – Generates static or randomized input for testing purposes.
  • null – Provides no stats / disable interface collection

Output Modules

  • curses – Default view as seen above
  • ascii – Prints highly configurable diagrams and lists to standard output.
  • format – Provides ability to format ascii output for scripting.
  • null – Disables primary output

For more in-depth information, please use the links in the resources section.

Specifying Input Modules

To select an input module you can issue the -i option followed by the desired module name. For example to use the proc input module:

Specifying Output Modules

Conversely, to specify a desired output module you can use the -o option. Here is an example using the ascii output module.

Conclusion

Bmon is a very powerful bandwidth monitoring tool. It has many options and configurations that are outside the scope of this tutorial. If you are interested in advanced usage of bmon, we suggest you read the detailed man pages and documentation available on it’s Github project page.

This post mentions some linux command line tools that can be used to monitor the network usage.

These tools monitor the traffic flowing through network interfaces and measure the speed at which data is currently being transferred. Incoming and outgoing traffic is shown separately.

Some of the commands, show the bandwidth used by individual processes. This makes it easy to detect a process that is overusing network bandwidth.

The tools have different mechanisms of generating the traffic report.

Some of the tools like nload read the “/proc/net/dev” file to get traffic stats, whereas some tools use the pcap library to capture all packets and then calculate the total size to estimate the traffic load.

Here is a list of the commands, sorted by their features.

Now lets take a look at each of the commands and how to use them to monitor network usage:

1. Nload

Nload is a commandline tool that allows users to monitor the incoming and outgoing traffic separately.

It also draws out a graph to indicate the same, the scale of which can be adjusted. Easy and simple to use, and does not support many options.

So if you just need to take a quick look at the total bandwidth usage without details of individual processes, then nload will be handy.

How to use bmon to monitor network bandwidth on linux

2. iftop

Iftop measures the data flowing through individual socket connections, and it works in a manner that is different from Nload.

Iftop uses the pcap library to capture the packets moving in and out of the network adapter, and then sums up the size and count to find the total bandwidth under use.

Although iftop reports the bandwidth used by individual connections, it cannot report the process name/id involved in the particular socket connection.

But being based on the pcap library, iftop is able to filter the traffic and report bandwidth usage over selected host connections as specified by the filter.

The n option prevents iftop from resolving ip addresses to hostname, which causes additional network traffic of its own.

How to use bmon to monitor network bandwidth on linux

3. iptraf

Iptraf is an interactive and colorful IP Lan monitor. It shows individual connections and the amount of data flowing between the hosts. Here is a screenshot

How to use bmon to monitor network bandwidth on linux

4. nethogs

Nethogs is a small ‘net top’ tool that shows the bandwidth used by individual processes and sorts the list putting the most intensive processes on top.

In the event of a sudden bandwidth spike, quickly open nethogs and find the process responsible. Nethogs reports the PID, user and the path of the program.

How to use bmon to monitor network bandwidth on linux

5. bmon

Bmon (Bandwidth Monitor) is a tool similar to nload that shows the traffic load over all the network interfaces on the system. The output also consists of a graph and a section with packet level details.

How to use bmon to monitor network bandwidth on linux

6. slurm

Slurm is ‘yet’ another network load monitor that shows device statistics along with an ascii graph. It supports 3 different styles of graphs each of which can be activated using the c, s and l keys. Simple in features, slurm does not display any further details about the network load.

How to use bmon to monitor network bandwidth on linux

7. speedometer

Another small and simple tool that just draws out good looking graphs of incoming and outgoing traffic through a given interface.

How to use bmon to monitor network bandwidth on linux

8. ifstat

The ifstat reports the network bandwidth in a batch style mode. The output is in a format that is easy to log and parse using other programs or utilities.

Install ifstat – Ubuntu, Debian and Fedora users have it in the default repos. CentOS users need to get it from Repoforge, since its not there in Epel.

8. dstat

Dstat is a versatile tool (written in python) that can monitor different system statistics and report them in a batch style mode or log the data to a csv or similar file. This example shows how to use dstat to report network bandwidth

9. collectl

Collectl reports system statistics in a style that is similar to dstat, and like dstat it is gathers statistics about various different system resources like cpu, memory, network etc.

Over here is a simple example of how to use it to report network usage/bandwidth.

Conclusion

Those were a few handy commands to quickly check the network bandwidth on your linux server. However these need the user to login to the remote server over ssh.

Alternatively web based monitoring tools can also be used for the same task.

Ntop and Darkstat are some of the basic web based network monitoring tools available for Linux.

Beyond these lie the enterprise level monitoring tools like Nagios that provide a host of features to not just monitor a server but entire infrastructure.

Maintaining a network also means preserving its bandwidth. Bandwidth leaks can cause network users to complain and slow application response. On a Linux system, we can use a tool called bmon to monitor bandwidth in real time.

What is bmon

Bmon or Bandwidth Monitoring is a tool that is intended for debugging and monitoring bandwidth in real-time access. This tool is able to get statistics from various input modules. It offers a variety of output methods including a cursed interface.

installation

On my Zorin OS, which is based on Ubuntu 13.04, I can install it by typing:

This will install bmon immediately. But the bmon version on this Ubuntu 13.04 is 2.0.103. While the latest version at the time of this writing is version 3.1.

In this article we are using the latest version. This version is only available in tar.gz format. Here are the steps to install.

1. Download the latest version from the Carisma website

3. Go to the extracted folder

4. Compile and install bmon

If you have some bugs that we had this can help you.

Please note that we are using an Ubuntu based distribution. These steps may be different for other Linux distributions.

No CONFUSE library

To fix this error, install the libconfuse library.

No LIBNL library

To fix these errors, install the LibNL library.

Further details on the LIBNL library can be found on the bmon website: https://www.carisma.slowglass.com/

Run bmon

After bmon is installed we can run bmon by typing bmon in the terminal.

How to use bmon to monitor network bandwidth on linux

Without an option, bmon will run in standard curse mode. The Bmon diagram is divided into a few parts.

  • The first line shows us the available interfaces, Receive Transmit and Transfer Transmit. This line is represented by the letter l, which means list view.
  • The second line contains graphical statistics. If the graph doesn’t appear, you can press the g key.
  • The third line shows us the detailed statistics of the reception and transfer activity.
  • And the fourth line shows us the additional information.

For help on using bmon, press the question mark key (?).

How to use bmon to monitor network bandwidth on linux

We can also run bmon with options. Here are some options for bmon.

Set input modules

bmon has some input modules. There are netlink, proc, dummy, and null.
To define it ourselves we can use the -i option. For example, if we wanted to use input from the / proc / net / dev file, we could type:

Set output modules

bmon has some output modules. There are curses, ASCII, format and zero. By default, bmon uses curses as output. If we want to use the ASCII output we can type:

For help on ASCII modules, type:

How to use bmon to monitor network bandwidth on linux

Set a specific interface for display

To do this, we can use the -p option.

With this option, bmon only lists the eth0 interface. If you enter eth *, all interfaces with the patterns eth0, eth1 to ethX are listed.

How to use bmon to monitor network bandwidth on linux

Set reading interval

By default, bmon creates statistics every 1 second. If we want to change it we can use the -r option. Suppose we want to change it in 10 seconds, we can run bmon with:

diploma

bmon can be a handy tool for debugging and monitoring bandwidth in real-time mode. This program is light and easy to use. As usual, we can always type man bmon or bmon –help to display the manual page and explore it in more detail.

Bmon Stands is an open source tool for the bandwidth monitoring tool. bmon is a powerful CLI based network bandwidth monitoring and debugging tool for Unix / Linux systems to capture networking related statistics & present them visually on the command line in a human-friendly way. It captures the traffic usage over all the network interfaces on the system. It is an effective and fast real-time network bandwidth monitor and rate estimator.

It features various output methods such as :

  • HTML output
  • ASCII output
  • Graphical visualization
  • An interactive curses user interface
  • A programmable text output for scripting

bmon installation in Linux:

It can be easily installed from the default package manager as almost all Linux distributions has bmon package in the default repositories but the available version might be a little older.

On RHEL/CentOS/Fedora:

On Fedora 22+:

On Debian/Ubuntu/Mint:

On openSUSE system:

On Arch Linux based systems:

For the most recent version of bmon (i.e version 4.0), you have to build it from its source using the following commands for different Linux distros:

For Debian based systems :

For CentOS 6, RHEL based systems:

For OSX installation :

Full help is provided through the following command :

Bandwidth Monitor ( BMON ) : Getting started

Running bmon to capture live bandwidth usage

After completing the bmon installation successfully via the help of above commands for different distros, just type the following command to run the bmon tool :

How to use bmon to monitor network bandwidth on linux

To view the quick reference of bmon as below press [Shift + ?] :

How to use bmon to monitor network bandwidth on linux

bmon shows only interface information by default. To load the graphics, enter g, i, or d (depending on the distro) for detailed graphical visualization of information.

How to use bmon to monitor network bandwidth on linux

Set the specific interface to display :

To monitor the enp1s0 network interface, we will use the flag -p to set policy defining which network interfaces to display as below :

To see the result in bit per second instead of bytes per second, use the -b flag like so :

To define the intervals per second use -r flag as below :

This article depends on Network Monitoring. I will share a few commands which will give you the points of interest of Network transmission capacity utilization. These are the best commands to get a quick look about your network utilization. These commands will monitor network transfer speed and bandwidth of all incoming and outgoing traffic.

1. NLOAD

Nload is a command line tool which is used to monitor network bandwidth of incoming and outgoing traffic. Nload is easy to use and no any other supported options are available.

In the event that you need to investigate incoming/outgoing traffic then nload will be the great choice.

2. BMON

Bmon is like nload but bmon will give you some more detail. bmon (Bandwidth Monitoring) is another apparatus to monitor bandwidth on a Linux machine. The output of bmon tool additionally gives a diagram and packet details. you can pick ethernet alternative by up/down arrow to check bandwidth on the graph.

You can also use the “d” option to get extra network details.

3. VNSTAT

vnstat is an alternate tool from different tools. It will keep running as a background process or daemon. Continue putting away the extent of information exchange constantly. You can be checked the historical backdrop of system bandwidth utilization with the usage of vnstat.

When you run this vnstat first time it will give you notice message “eth3: Not enough data available yet“. Attempt this command after some time so the vnstat will assemble a few subtle elements identified with network usage.

If you want the current status of network usage then run below command with some options.

4. IFSTAT

ifstat give network usage in group style mode. Use beneath command of ifstat which gives you bandwidth with subtle elements of Time, information move In/Out and so forth.

We have utilized “- t” and “- I” alternative with ifstat command. – t give the time and – I is used to mentioning ethernet.

5. DSTAT

dstat is an adaptable asset insights tool. dstat give you subtle elements in sections and unmistakably appears in what size and unit are shown. It will indicate details in exactly with the same time period. It is composed in python. You can utilize the choice to indicate different values with different colors. You can check “man page” for various alternatives.

If you use only dstat command it will give you complete information like total-CPU-usage, dsk/total, net/total, paging etc.

This post mentions some linux command line tools that can be used to monitor the network usage. These tools monitor the traffic flowing through network interfaces and measure the speed at which data is currently being transferred. Incoming and outgoing traffic is shown separately.

1. Nload

Nload is a commandline tool that allows users to monitor the incoming and outgoing traffic separately. It also draws out a graph to indicate the same, the scale of which can be adjusted. Easy and simple to use, and does not support many options.

So if you just need to take a quick look at the total bandwidth usage without details of individual processes, then nload will be handy.

How to use bmon to monitor network bandwidth on linux

Installing Nload – Fedora and Ubuntu have got it in the default repos. CentOS users need to get nload from Epel repositories.

2. iftop

Iftop measures the data flowing through individual socket connections, and it works in a manner that is different from Nload. Iftop uses the pcap library to capture the packets moving in and out of the network adapter, and then sums up the size and count to find the total bandwidth under use.

Although iftop reports the bandwidth used by individual connections, it cannot report the process name/id involved in the particular socket connection. But being based on the pcap library, iftop is able to filter the traffic and report bandwidth usage over selected host connections as specified by the filter.

The n option prevents iftop from resolving ip addresses to hostname, which causes additional network traffic of its own.

How to use bmon to monitor network bandwidth on linux

Install iftop – Ubuntu/Debian/Fedora users get it from default repos. CentOS users get it from Epel.

3. iptraf

Iptraf is an interactive and colorful IP Lan monitor. It shows individual connections and the amount of data flowing between the hosts. Here is a screenshot

How to use bmon to monitor network bandwidth on linux

4. nethogs

Nethogs is a small ‘net top’ tool that shows the bandwidth used by individual processes and sorts the list putting the most intensive processes on top. In the event of a sudden bandwidth spike, quickly open nethogs and find the process responsible. Nethogs reports the PID, user and the path of the program.

How to use bmon to monitor network bandwidth on linux

Install Nethogs – Ubuntu, Debian, Fedora users get from default repos. CentOS users need Epel

5. bmon

Bmon (Bandwidth Monitor) is a tool similar to nload that shows the traffic load over all the network interfaces on the system. The output also consists of a graph and a section with packet level details.

How to use bmon to monitor network bandwidth on linux

Install Bmon – Ubuntu, Debian and Fedora users can install from default repos. CentOS users need to setup repoforge, since its not available in Epel.

Bmon supports many options and is capable of producing reports in html format. Check the man page for more information

6. slurm

Slurm is ‘yet’ another network load monitor that shows device statistics along with an ascii graph. It supports 3 different styles of graphs each of which can be activated using the c, s and l keys. Simple in features, slurm does not display any further details about the network load.

How to use bmon to monitor network bandwidth on linux

7. tcptrack

Tcptrack is similar to iftop, and uses the pcap library to capture packets and calculate various statistics like the bandwidth used in each connection. It also supports the standard pcap filters that can be used to monitor specific connections.

How to use bmon to monitor network bandwidth on linux

Install tcptrack – Ubuntu, Debian and Fedora have it in default repos. CentOS users need to get it from RepoForge as it is not available in Epel either.

8. Vnstat

Vnstat is bit different from most of the other tools. It actually runs a background service/daemon and keeps recording the size of data transfer all the time. Next it can be used to generate a report of the history of network usage.

Running vnstat without any options would simply show the total amount of data transfer that took place since the date the daemon is running.

To monitor the bandwidth usage in realtime, use the ‘-l’ option (live mode). It would then show the total bandwidth used by incoming and outgoing data, but in a very precise manner without any internal details about host connections or processes.

Vnstat is more like a tool to get historic reports of how much bandwidth is used everyday or over the past month. It is not strictly a tool for monitoring the network in real time.

Vnstat supports many options, details about which can be found in the man page.

9. bwm-ng

Bwm-ng (Bandwidth Monitor Next Generation) is another very simple real time network load monitor that reports a summary of the speed at which data is being transferred in and out of all available network interfaces on the system.

If the console size is sufficiently large, bwm-ng can also draw bar graphs for the traffic using the curses2 output mode.

Install Bwm-NG – On CentOS bwm-ng can be installed from Epel.

10. cbm – Color Bandwidth Meter

A tiny little simple bandwidth monitor that displays the traffic volume through network interfaces. No further options, just the traffic stats are display and updated in realtime.

How to use bmon to monitor network bandwidth on linux

11. speedometer

Another small and simple tool that just draws out good looking graphs of incoming and outgoing traffic through a given interface.

How to use bmon to monitor network bandwidth on linuxSandra Henry-Stocker

Bmon is a monitoring and debugging tool that runs in a terminal window and captures network statistics, offering options on how and how much data will be displayed and displayed in a form that is easy to understand.

To check if bmon is installed on your system, use the which command:

Getting bmon

On Debian systems, use sudo apt-get install bmon to install the tool.

For Red Hat and related distributions, you might be able to install with yum install bmon or sudo dnf install bmon. Alternately, you may have to resort to a more complex install with commands like these that first set up the required libconfuse using the root account or sudo:

The first five lines will install libconfuse and the second five will grab and install bmon itself.

Using bmon

The simplest way to start bmon is simply to type bmon on the command line. Depending on the size of the window you are using, you will be able to see and bring up a variety of data.

The top portion of your display will display stats on your network interfaces – the loopback (lo) and network-accessible (e.g., eth0). If you terminal window has few lines, this is all you may see, and it will look something like this:

In this example, the network interface is enp0s25. Notice the helpful “Increase screen height” hint below the listed interfaces. Stretch your screen to add sufficient lines (no need to restart bmon) and you will see some graphs:

Notice, however, that the graphs are not showing values. This is because it is displaying the loopback >lo interface. Arrow your way down to the public network interface and you will see some traffic.

The change allows you to view a graph displaying network traffic. Note, however, that the default is to display bytes per second. To display bits per second instead, you would start the tool using bmon -b

Detailed statistics on network traffic can be displayed if your window is large enough and you press d. An example of the stats you will see is displayed below. This display was split into left and right portions because of its width.

left side:
right side

Additional information on the network interface will be displayed if you press i

left side:
right side:

A help menu will appear if you press ? with brief descriptions of how to move around the screen, select data to be displayed and control the graphs.

To quit bmon, you would type q and then y in response to the prompt to confirm your choice to exit.

Some of the important things to note are that:

  • bmon adjusts its display to the size of the terminal window
  • some of the choices shown at the bottom of the display will only function if the window is large enough to accomodate the data
  • the display is updated every second unless you slow this down using the -R (e.g., bmon -R 5) option

Now see

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as “USL” (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she’s chasing the bears away from her bird feeders.

These tools need the network interface name as argument in the command line. To find out the network interface name (wired, wireless), run below command from terminal.

Good thing about these tools is they are available in Ubuntu repos. You can do just apt to install.

iftop

iftop listens to the network interface and gives you a list of hosts which is consuming data. Total incoming and outgoing data also shown. It can also show port numbers with hosts and able to convert the port numbers to services. Here are the complete options (–help).

How to Install

Run below command from terminal to install in Ubuntu, Linux Mint:

Command

How to use bmon to monitor network bandwidth on linux

Replace eth0 with your interface name.

slurm

slurm is a network load monitoring tool with color terminal graphs. It gives real-time traffic in terminal with three graph mode – combines RX and TX and two split views. Features from help:

How to Install

Run below command from terminal to install in Ubuntu, Linux Mint:

Command

How to use bmon to monitor network bandwidth on linux

bmon (a.k.a. Bandwidth Monitor) is a network monitoring tool and is able to monitor multiple interface traffic. It gives data about packets, errors and whole lot of information needed for monitoring. Features from help:

How to install

To install, run below command from terminal in Ubuntu, Linux Mint.

Command

Replace eth0 with your interface name.

How to use bmon to monitor network bandwidth on linux

We bring the latest tech, software news and stuff that matters. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

Bmon is a portable real-time bandwidth monitor and rate estimator. It supports different input methods for different architectures. There are several output modes, including an interactive curses interface, light HTML output, and simple ASCII output. Statistics can be distributed over a network using multicast or unicast and collected at a particular point in time to produce a summary of statistics for a set of nodes.

Install Bmon on Debian / Ubuntu Linux

For Debian / Ubuntu systems, enter the following command into a terminal:

Install Bmon from source

Here are the steps to install bmon from source:
Download the latest version from the Carisma website

Go to the extracted folder

Compile and install bmon

How to use bmon

Bmon is a console based tool, open up a terminal and type the command “bmon” and you should see the following output:

As shown, it lists all available interfaces. Below you will find two options for opening the graph and the detailed output by clicking on g and d, respectively. When that’s done, the output should look like this:

How to use bmon to monitor network bandwidth on linux

To get help with the operation of bmon, press the “?” Button:

How to use bmon to monitor network bandwidth on linux

Bmon can be a handy tool for debugging and monitoring bandwidth in real-time mode. For more features, you might want to take a look at the man page:

How to use bmon to monitor network bandwidth on linux

How to use bmon to monitor network bandwidth on linux

Without any explanations, let’s jump into the best bandwidth monitoring tools to analyze network usages in Linux operating systems.

Linux Bandwidth Monitoring Tools To Analyze Network Usage

1. iftop

iftop is a free command-line tool and one of the popular Linux bandwidth monitoring tools to monitor network connection in Linux. You need to have libpcap and libncurses installed to use iftop in Linux.

Run the following command in respective operating system to install libpcap and libncurses:

For Debian:

For Centos/ RedHat:

For Fedora:

Now, Install iftop in Linux:

For Debian:

For CentOS/RedHat:

For Fedora:

2. vnStat

vnStat is an another command line network utility tool to monitor network activities like it keeps a log of hourly, daily and monthly network traffic for the selected interface.

Install vnStat in Linux:

For RedHat/CentOS

For Ubuntu/Debian

3.NetHogs

Nethogs is a text line command tool to look over a real time statistics of network bandwidth of per process usage.

Install NetHogs in Linux:

For CentOS/RedHat

For Debian/Ubuntu

4. nload

nload is a console based application to monitors network traffic and bandwidth usage in real time. It visualizes the in- and outgoing traffic using (two) graphs with an additional info like the total amount of transferred data and min/max network usages.

Install nload in Linux:

For RedHat/CentOS

For Debian/Ubuntu

5. Darkstat

Darkstat is a cross-platform, lightweight, simple, real-time network statistics tool that captures network traffic, calculates statistics about usage, and serves reports over HTTP. It can be called as a web based network analyzer.

Install Darkstat in Linux:
For Redhat/CentOS

6. bmon

bmon is a bandwidth monitor and rate estimator tool for Linux.

Install bmon in Linux:

For RedHat/CentOS

For Debian/Ubuntu

7. CBM

Color bandwidth monitor or CBM is a simple to analyze networks. It displays the networks movement/statistics in a colored output.

Install CBM in Linux:

For RedHat/CentOS

For Debian/Ubuntu

8. IPTraf

IPTraf is a network monitoring utility for IP networks which intercepts packets on the network and gives out various pieces of information about the current IP traffic over it. It is a software-only, ncurses-based and utilizes the built-in raw packet capture interface of the Linux kernel.

Install IPTraf in Linux:

For RedHat/CentOS

For Debian/Ubuntu

9. Netperf

Netperf is a tool to test network bandwidth between two hosts on a network.

Installation tutorial for Netperf is here

10. Monitorix

Monitorix is a free, open source, lightweight system monitoring tool designed to monitor as it periodically collects system data and uses the web interface to show the information as graphs.

Install Monitorix in Linux

For Redhat/CentOS

For Debian/Ubuntu

11. Zabbix

Zabbix is an open-source monitoring software tool which provides monitoring metrics, among others network utilization, CPU load and disk space consumption.

Zabbix installation guide can be found here.

12. Cacti

Cacti is an open-source, network graphing solution. It is also a web-based network monitoring and graphing tool.

So here in this article, we are going to see how to limit a network bandwidth in Linux using WonderShaper. It is a tool which is a small bash script that enables us to limit the network bandwidth in Linux. It works as the tc command-line program as the backend for configuring traffic control in systems.

Here this tool allows us to set the maximum download rate and maximum upload rate. Even we can clear the limits that we have for downloading and uploading and even display the current status of the interface from the command line.

Installation:

Step 1: Let’s install WonderShaper in Linux:

How to use bmon to monitor network bandwidth on linux

Now we can install WonderShaper with a different method. By using this method we can have the latest updates of WonderShaper.

So before proceeding to this we need to have git (Git is a distributed version control system for tracking changes in any set of files) installed.

Step 2: First Navigate to the bin directory using the cd command in terminal

Step 3: Next using the below command download the latest version

Step 4: Now we want to WonderShaper directory and install it using the below one.

So now installation and setup is done for WonderShapper

Enable and start the service:

Now we will Enable and start the WonderShaper service. Next, we have to enable the service to allow it to start every time we automatically when the system boots. WonderShaper can run as a service like the other is Linux systems.

Now we have to enable and start the service in our system:

Even we can verify if the WonderShaper service is active. Using the following below command

If we want to stop the service we can use the below command

We can even restart the service if we have any problem with the service using the below command:

Now we can see how to use the WonderShapper tool:

Now we want to find the interface for which we have to limit the bandwidth. We can find the respective interface name using the following commands:

Now after knowing the interface name on which we want to limit the bandwidth using the below Command:

  • -a: defines interface name
  • -d: defines download rate in kbps
  • -u: defines upload rate in kbps

So for example,

Above, set the download rate to 2048 kbps and the upload rate to 512 kbps.

Even we can set both downloads rate and upload rate separately.

The above one will set the download rate to 4096 kbps

So now to clear or remove the bandwidth limits of an interface we can use the below command.

Bmon is a portable real-time bandwidth monitor and rate estimator. It supports different input methods for different architectures. There are several output modes, including an interactive curses interface, light HTML output, and simple ASCII output. Statistics can be distributed over a network using multicast or unicast and collected at a particular point in time to produce a summary of statistics for a set of nodes.

Install Bmon on Debian / Ubuntu Linux

For Debian / Ubuntu systems, enter the following command into a terminal:

Install Bmon from source

Here are the steps to install bmon from source:
Download the latest version from the Carisma website

Go to the extracted folder

Compile and install bmon

How to use bmon

Bmon is a console based tool, open up a terminal and type the command “bmon” and you should see the following output:

As shown, it lists all available interfaces. Below you will find two options for opening the graph and the detailed output by clicking on g and d, respectively. When that’s done, the output should look like this:

How to use bmon to monitor network bandwidth on linux

To get help with the operation of bmon, press the “?” Button:

How to use bmon to monitor network bandwidth on linux

Bmon can be a handy tool for debugging and monitoring bandwidth in real-time mode. For more features, you might want to take a look at the man page:

For the average desktop user, this might not be an important tool. But, if you run an Ubuntu server for instance and looking for a tool for getting the live network traffic statistics (with somewhat pretty graphs etc) of your system, then the “bmon” utility will come in handy.

It is not a network bandwidth logger as it only shows the live network traffic related data. By default it shows all the available network interfaces of your system, but you can enter the preferred network interface before executing the program (then again, you can easily switch between each interface using arrow keys too).

Though it’s a simple utility, it shows you a reasonable amount of “advanced” data of a network connection such as:

How to use bmon to monitor network bandwidth on linux

*. The total download/upload speeds per each interface.

*. Including graphs (up-to 60 seconds long).

*. Total network bandwidth usage for each interface.

*. Advanced info about network packets such as: sent/received packets, drop count, errors and multicast packets (and a lot more depending on your network configuration) count at the bottom section.

These are some of its features to mention.

If interested, you can install “bmon” in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by using the below command in your Terminal window.

To launch the application, simply enter the below command in your Console/Terminal window.

By default, it hides both graphs and the advanced network packet related data fields. But you can enable them by pressing both “g” and “d” keys respectively (works for both enabling and disabling). You can also use “Up/Down” arrow keys for switching between network interfaces (wlan, eth etc) and can press “q” to quit the application.

If you want, you can reads its manual as it explains a lot of other details and tweaks, please use the below command for that.

How to use bmon to monitor network bandwidth on linux

How do I test network speed between two Linux servers?

How do I check the speed between the two Linux servers using command line options for private LAN/VLAN? You can test the network speed/throughput between Ubuntu/CentOS/Debian/Fedora Linux or Unix box using the iperf command. Iperf commands show info about bandwidth, delay, jitter, and datagram loss.

How do I find my network utilization on Linux?

  1. ManageEngine Netflow Analyzer.
  2. Vnstat Network Traffic Monitor Tool.
  3. Iftop Display Bandwidth Usage.
  4. nload – Monitor Network Usage.
  5. NetHogs – Monitor Network Usage Per User.
  6. Bmon – Bandwidth Monitor and Rate Estimator.
  7. Darkstat – Captures Network Traffic.

How do I check bandwidth?

For a simple bandwidth measurement on a single PC, Windows Task Manager can show basic data about your Wi-Fi and ethernet connection. Just select the Performance tab and then click the network interface. In the example below, you can see what happens when watching a YouTube trailer.

How do you check what devices are using bandwidth?

  1. Track Bandwidth Usage via Your Router. The best place to start figuring out what is consuming your bandwidth is your router. .
  2. Check Bandwidth Usage With Capsa. .
  3. Scan Your System for Malware. .
  4. Use Netstat to Uncover Network Issues. .
  5. Check Network Activity With Windows Resource Monitor.

What is a good bandwidth?

To put it briefly, Internet speeds in the 100–200 Mbps range are ideal for most households since they can handle common uses like streaming and video chat for 2–5 users at once. . Mbps stands for “Megabits per second.” This is the standard measure of “speed” or “bandwidth” on home internet connections.

How do I check my mobile bandwidth?

icon on your Apps menu to open your Settings. Tap Data usage. It’s located under the “Wireless & Networks” heading on the Settings menu. If you don’t see this option on the menu, tap More under Wireless & Networks.

What is a good bandwidth speed?

The Federal Communications Commission (FCC) says that speeds of 3-8 megabits per second (Mbps) are just fine for the low-end user with one or two people in the household. Students and telecommuters require 5-25 Mbps, and higher-need internet users will want download speeds of at least 25 Mbps.

What is my local network speed Linux?

  1. Using speedtest-cli to Test Internet Speed. .
  2. Using fast-cli to Test Internet Speed. .
  3. Using CMB to Show Network Speed. .
  4. Using iperf to Measure Network Speed Between Two Devices. .
  5. Using nload to View Incoming and Outgoing Network Traffic. .
  6. Using tcptrack to Test Network Activity.

How do I check my Iperf bandwidth?

  1. Download the iperf utility. .
  2. On the server that will be receiving data, open an elevated command window and run the following command: “iperf.exe –s –w 2m”.
  3. On the server that will be sending data, open an elevated command window and run the following command: “iperf –c x.x.x.x –w 2m –t 30s –i 1s”.

How can I check bandwidth between two servers?

Iperf is a free software tool that can measure the bandwidth between two nodes in a computer network and the quality of a network link. Idea is to run Iperf on both computers and measure bandwidth between them, where one computer is a client and the other is a server.

How to use bmon to monitor network bandwidth on linux


Bmon
is a portable real-time bandwidth monitor and rate estimator. It supports various input methods for different architectures. Various output modes exist, including an interactive curses interface, lightweight HTML output, and simple ASCII output. Statistics may be distributed over a network using multicast or unicast and collected at some point to generate a summary of statistics for a set of nodes.

Install Bmon on Debian/Ubuntu linux

For Debian/Ubuntu systems type following command in a terminal:

Install Bmon from source code

Here are the steps to install bmon from source code:
Download the latest version from Carisma website

Go the the extracted folder

Compile and install bmon

How to use bmon

Bmon is an console based tool, open a terminal and enter the commandbmon” and you should see the following output:

As shown, it lists all the available interfaces. At the bottom, you will find two options to open graph and detailed output by clicking g and d respectively. If done, the output should look like this:

To get some help how to operate bmon, press “?“button:

bmon help screen

Bmon can be a handy tool for debugging and monitor bandwidth in real-time mode. For more features, you might want to take a look at its man page:

Related Posts

How to use bmon to monitor network bandwidth on linux

Setup MySQL Master-Slave Replication on Ubuntu 18.04

How to use bmon to monitor network bandwidth on linux

MC Linux Interactive tool – Midnight Commander

How to use bmon to monitor network bandwidth on linux

16 Bandwidth Monitoring Tools to Analyze Network Usage in Linux

About Author

adminus

Linux Windows & Networks System Administrator with some years of professional working experiance in the IT field. This is my personal blog where I make some notes and memo’s on interesting materials.

This article will list some of the most popular command line network speed monitoring tools available for Linux. Before going ahead, take heed of a few things. Some commands require root permissions to access network information. If you are not comfortable with these apps, many other no-root options are mentioned below.

Secondly, the command below will be regularly used to auto detect currently active network interface on your system. Whenever you see this command used in other commands, you can replace it with proper name of a network interface if you know it.

Let’s get started.

Ifstat

Ifstat is a simple command line utility that displays network bandwidth consumption and speed at regular intervals.

To install ifstat in Ubuntu, run the command below:

To view network speed for all interfaces, run the command below:

How to use bmon to monitor network bandwidth on linux

To view network speed for active interface only, run the command below:

How to use bmon to monitor network bandwidth on linux

Slurm

Slurm is command line tool to monitor real time network traffic. Apart from statistics about incoming and outgoing traffic, it also displays colorful ascii graphics to represent network consumption.

To install slurm in Ubuntu, run the command below:

To view network speed of currently active interface, run the command below:

How to use bmon to monitor network bandwidth on linux

Bmon is a command line tool to capture and monitor network traffic activity. By default, it shows network speed in an interactive curses based user interface inside a terminal. However, it supports other output formats like HTML and plain text as well.

To install Bmon in Ubuntu, run the command below:

To view network speed for all interfaces, run the command below:

How to use bmon to monitor network bandwidth on linux

To view network speed for active interface only, run the command below:

How to use bmon to monitor network bandwidth on linux

Speedometer

Speedometer, as the name suggests, is a tool for monitoring and measuring network bandwidth. It’s terminal based interface uses colorful labels and graphs to represent bandwidth consumption and network speed.

To install speedometer in Ubuntu, run the command below:

To view network speed of currently active interface, run the command below:

How to use bmon to monitor network bandwidth on linux

Nethogs

Nethogs is a command line “top” tool for monitoring network speed. It works similar to top / htop utility and displays network speed for every process that is responsible for in or out network traffic.

To install nethogs in Ubuntu, run the command below:

To view network speed for all interfaces, run the command below:

How to use bmon to monitor network bandwidth on linux

To view network speed of currently active interface, run the command below:

Iftop

Iftop is another network monitoring tool that works like “top” command line tool. It displays network traffic for different processes in a tabular form.

To install Iftop in Ubuntu, run the command below:

To view network speed of currently active interface, run the command below:

How to use bmon to monitor network bandwidth on linux

Vnstat

Vnstat is simple and straightforward tool for monitoring network speed. Though it does not have bells and whistles of other tools mentioned above, it just works and can show network speed in just one line.

To install Vnstat in Ubuntu, run the command below:

To view network speed of currently active interface, run the command below:

How to use bmon to monitor network bandwidth on linux

Nload

Nload is a console based utility that can display real time network traffic statistics as well as maximum, minimum, and average bandwidth consumption.

To install Nload in Ubuntu, run the command below:

To view network speed of currently active interface, run the command below:

How to use bmon to monitor network bandwidth on linux

Wavemon

Wavemon is a command line tool that allows you to monitor wireless signal quality, speed, bandwidth consumption, and other useful information about your wireless connection.

To install Wavemon in Ubuntu, run the command below:

To view network speed of currently active wireless interface, run the command below:

How to use bmon to monitor network bandwidth on linux

Conclusion

Some apps have been omitted from this list as they aren’t being maintained anymore. However, almost all of the tools mentioned above come pre-installed by default on most Linux distributions and require no setup. They are useful for desktop PCs and are also extensively used for remotely monitoring servers.

About the author

Nitesh Kumar

I am a freelancer software developer and content writer who loves Linux, open source software and the free software community.

  • Nikhil Bhaskar
  • November 30, 2021

Steps to Setup Bmon Monitoring & Debugging Tool on Ubuntu 20.04

Bmon is a free & open source monitoring & debugging tool. It is used to monitor the network related information. It is a simple & easy to use tool & used for real-time bandwidth monitor.

There are some steps to setup bmon on ubuntu:

Step 1: Update the System.

Step 2: Install Bmon on system.

apt-get install bmon

  • Here is the command output.
  • Check Bmon version.

bmon –version
or
bmon -v

  • Here is the command output.

Step 3: Bmon Syntax & Examples:

  • To Run bmon command,capture live bandwidth usage.
  • Here is the command output.

How to use bmon to monitor network bandwidth on linux

  • Press d,to enable detailed statistics.

How to use bmon to monitor network bandwidth on linux

  • Press i, to enable additional information.

How to use bmon to monitor network bandwidth on linux

  • Press Shift + ?, to display the quick reference.

How to use bmon to monitor network bandwidth on linux

  • To monitor the network interface.

Syntax:

bmon -p interface-name

Example:

  • Here is the command output.

How to use bmon to monitor network bandwidth on linux

  • Use -b flag,to display the monitoring bit per second instead of bytes per second.
  • Here is the command output.

How to use bmon to monitor network bandwidth on linux

  • To use -r flag,for intervals per second.

bmon -r 5 -p eth0

  • Here is the command output.

How to use bmon to monitor network bandwidth on linux

Bmon Input Modules

netlink – It is the default input module & its a protocol to collect interface and traffic control statistics from the kernel.
proc — It reads interface statistics from the /proc/net/dev file. I
dummy – It is a programmable input module for debugging and testing purposes.
null – It is used for disables data collection.

There are many popular monitoring tools available in the market and we’ve analyzed the top 5 free network monitoring tools for Linux below:

Nload is a command line tool that allows users to monitor the incoming and outgoing traffic separately. It also draws out a graph to indicate the same, the scale of which can be adjusted. Easy and simple to use, and does not support many options.

So if you just need to take a quick look at the total bandwidth usage without details of individual processes, then nload will be handy.

Installing Nload – Fedora and Ubuntu have got it in the default repos. CentOS users need to get nload from Epel repositories.

Iftop measures the data flowing through individual socket connections, and it works in a manner that is different from Nload. Iftop uses the pcap library to capture the packets moving in and out of the network adapter, and then sums up the size and count to find the total bandwidth under use.

Although iftop reports the bandwidth used by individual connections, it cannot report the process name/id involved in the particular socket connection. But being based on the pcap library, iftop is able to filter the traffic and report bandwidth usage over selected host connections as specified by the filter.

The n option prevents iftop from resolving ip addresses to hostname, which causes additional network traffic of its own.

Install iftop – Ubuntu/Debian/Fedora users get it from default repos. CentOS users get it from Epel.

Iptraf is an interactive and colorful IP Lan monitor. It shows individual connections and the amount of data flowing between the hosts. Here is a screenshot

Install iptraf

Build from source :

For Centos/RHEL (7.3, 7.4)

For Ubuntu (16.04, 17.10, 18.04)

Download and extract IPTraf

Build and install IPTraf

Set PATH variable

Run IPTraf using the command below

Bmon (Bandwidth Monitor) is a tool similar to nload that shows the traffic load over all the network interfaces on the system. The output also consists of a graph and a section with packet level details.

Install Bmon – Ubuntu, Debian and Fedora users can install from default repos. CentOS users need to setup repoforge, since its not available in Epel.

Bmon supports many options and is capable of producing reports in html format. Check the man page for more information

Vnstat is bit different from most of the other tools. It actually runs a background service/daemon and keeps recording the size of data transfer all the time. Next it can be used to generate a report of the history of network usage.

Running vnstat without any options would simply show the total amount of data transfer that took place since the date the daemon is running.

Vnstat is more like a tool to get historic reports of how much bandwidth is used everyday or over the past month. It is not strictly a tool for monitoring the network in real time.

Vnstat supports many options, details about which can be found in the man page.

There are several ways to get interface statistics on their network counters. The most basic one is to use the ip command (or the older ifconfig). There are other utilities too, but the common theme between them is that they give a snapshot of the network statistics and everything is left to the user. For example, if you want to plot a graph of some network metric or compare statistics between interfaces, you’d need to use some third party tool or a spreadsheet.

bmon is tool that overcomes these limitations, and takes network statistics to the next level.

Installation

bmon has been around for several years now, so you should be able to install it with something simple like:

As of September 2021, installing bmon with apt-get installs the latest version of the tool, 4.0, which is the same as the one on github .

Usage

The simplest way to run bmon is to just type the command on the CLI without any arguments. You will get something like the following:

How to use bmon to monitor network bandwidth on linux

Actually, my blogpost could end here, because bmon has a pretty nice and comprehensive help menu on the application, so everything you need, can be most likely be found by pressing “?” to open the help menu. After you open bmon, the first commands to give are:

  • ‘d’: to enable detail statistics
  • ‘i’: to to enable additional information
  • “h”: to enable recording of historical data

In addition, when I launch bmon I add the -b flag so that it uses bits as the measurement unit (and not bytes, which is the default). So, after launching it with:

And pressing “d, i, h” I get the following:

How to use bmon to monitor network bandwidth on linux

By default, the cursor will be on the “lo” loopback interface, and by using the down arrow I brought the cursor to the “eth0” interface. If you use the left/right arrows you will get different statistics on the plots.

In the example above I ran a speedtest so that there is a substantial amount of traffic on the interface to be recorded, and then I ran a speedtest, and you can clearly see what I was getting on my screen. The green Rx plot (download bandwidth) and red Tx plot (upload bandwidth) show values that are pretty close to the traffic measured by the speedtest itself.

bmon gives you a pretty complete picture of the network statistics on all the interfaces of the system and has a very good documentation. I would recommend it as a useful utility that you can use when troubleshooting network problems. After all, installing the latest version of bmon is very easy since it’s available on all repositories.

How to use bmon to monitor network bandwidth on linux

Many server administrators need a tool to monitor the total bandwidth downloaded or uploaded to the server. The server administrator may use a control panel such as DirectAdmin, cPanel, Plesk, WebSitePanel, or Kloxo to better manage the server, depending on the server operating system. In this article, we are going to teach you How to Monitor Network Traffic with vnStat on Centos 7. It should note that you can visit the packages available in Eldernode to purchase a CentOS VPS server.

Table of Contents

Tutorial Monitor Network Traffic with vnStat on CentOS 7

Traffic monitoring of a VPS server is one of the important things to check the performance of the server. You can use the vnStat tool to do this. Follow us in this article to teach you How to Monitor Network Traffic with vnStat on CentOS 7.

vnStat Features:

In this section, we will introduce 14 vnStat features:

1- Statistics remain available even after system reboots

2- Monitor multiple network interfaces at the same time

3- Multiple output options

4- Sort the data by hour, day, month, week or get the top 10 days

5- Generate png graphic of the output

6- Configure “Months” to follow up with different billing cycles you may have

7- Very light – consumes a really small portion of your system resources

8- Low CPU usage no matter how much traffic you generate

9- You don’t have to be root to use it

10- Select units dynamically (KB, MB, etc)

11- You can add a legend to generated output image

12- Customizable options for content positioning and image background color to vnStat.cgi.

13- The interface bandwidth will be automatically detected.

14- Use JSON for output

How to Install vnStat on CentOS 7 | Centos 8

Once you are familiar with the features of vnStat, in this step we want to teach you how to install vnStat on CentOS 7. After installing vnStat, in the next step, we will teach you how to Monitor Network Traffic with this tool. Please join us. The first step in installing vnStat is to enable the EPEL repositories package. Then you need to execute the following commands in order:

The important point is that if after installing the program you notice that the program is not updated or does not display any output, you should set the permissions as follows:

How to Configure vnStat on CentOS 7

In this section, we are going to configure vnStat and then how to create a database. Please join us. The first step is to edit the /etc/vnstat.conf configuration file:

The sample output will be as follows:

Now you need to enter the following command to edit /etc/vnstat.conf:

Set the default interface to eth1 as in the following command:

Now save the configuration file and exit it.

To create a database, you must first set the vnStat shell to /bin/bash using the chsh command. Then create a database using the following commands:

Note that this is usually the first command used after a new installation. You can use the runuser command to create a database for the eth0 interface:

You can also run the following command to create a database for the eth1 interface:

Use the following commands to ensure that the vnStat user cannot log in:

How to Monitor Network Traffic with vnStat on CentOS Linux

To start the vnStat service at boot time, type the following command:

You can also run the following commands to start/stop/restart and control the vnStart service, respectively:

How to view the statistics will be as follows. The syntax is:

You can see an example output in the image below:

How to use bmon to monitor network bandwidth on linux

You can enter the following command to view eth0 statistics:

Note that to see the daily stats for eth0, you can enter the following command:

You can also enter the following command to see the hourly statistics:

To see the monthly statistics, run the following command:

Finally, to see the weekly statistics, run the following command:

Note that you can use the following command to calculate traffic:

The output of the above command will be as follows:

How to use bmon to monitor network bandwidth on linux

Conclusion

One of the advantages of vnStat is its lightness, which does not impose a special load on the server. This software claims to calculate all the traffic transferred on the service network, whether web server traffic or even the volume of ICMP packets. Consumer traffic will also be visible on an hourly, daily, and monthly basis. In this article, we tried to teach you how to install and monitor Network Traffic with vnStat on CentOS 7.

How to use bmon to monitor network bandwidth on linux

I have already written an article to check the network bandwidth speed using netperf available at below link
How to monitor network bandwidth in Linux using netperf

In this article I will guide you the steps to be used to monitor the available network bandwidth using iperf3.
One advantage here you have with iperf3 that it is a part of the Red Hat Vanilla DVD and you need not download any third party tool.

Below steps are validated on Red Hat Enterprise Linux 7

You can install the iperf3 using yum command assuming you have a valid repository or you can copy the rpm from the Red Hat DVD and install it manually

The latest version of the iperf source code is at https://github.com/esnet/iperf

With the below list of steps the iperf sets a large send and receive buffer size to maximise throughput, and performs a test for 60 seconds which should be long enough to fully exercise a network.

On Server (IP: 10.58.160.101)

# yum install iperf3
OR
# rpm -Uvh /home/deepak/iperf3-3.1.7-2.el7.x86_64.rpm
warning: /home/deepak/iperf3-3.1.7-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing. ################################# [100%]
Updating / installing.
1:iperf3-3.1.7-2.el7 ################################# [100%]
Explanation of the switches used:
-i, –interval n
pause n seconds between periodic bandwidth reports; default is 1, use 0 to disable
-s, –server
run in server mode
Run the below command on the server
server # iperf3 -i 10 -s
warning: this system does not seem to support IPv6 – trying IPv4
———————————————————–
Server listening on 5201
———————————————————–
Accepted connection from 10.58.160.103 , port 40614
[ 5] local 10.58.160.101 port 5201 connected to 10.58.160.103 port 40616
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.00 sec 1.27 GBytes 1.09 Gbits/sec
[ 5] 10.00-20.00 sec 1.27 GBytes 1.09 Gbits/sec
[ 5] 20.00-30.00 sec 1.27 GBytes 1.09 Gbits/sec
[ 5] 30.00-40.00 sec 1.27 GBytes 1.09 Gbits/sec
[ 5] 40.00-50.00 sec 1.27 GBytes 1.09 Gbits/sec
[ 5] 50.00-60.00 sec 1.27 GBytes 1.09 Gbits/sec
[ 5] 60.00-60.04 sec 4.78 MBytes 1.04 Gbits/sec
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-60.04 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-60.04 sec 7.63 GBytes 1.09 Gbits/sec receiver
———————————————————–
Server listening on 5201
———————————————————–
Accepted connection from 192.169.173.7 , port 35190
[ 5] local 192.169.173.5 port 5201 connected to 192.169.173.7 port 35192
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.00 sec 3.55 GBytes 3.05 Gbits/sec
[ 5] 10.00-20.00 sec 3.59 GBytes 3.08 Gbits/sec
[ 5] 20.00-30.00 sec 3.59 GBytes 3.08 Gbits/sec
[ 5] 30.00-40.00 sec 3.59 GBytes 3.08 Gbits/sec
[ 5] 40.00-50.00 sec 3.59 GBytes 3.08 Gbits/sec
[ 5] 50.00-60.00 sec 3.59 GBytes 3.08 Gbits/sec
[ 5] 60.00-60.04 sec 14.4 MBytes 3.14 Gbits/sec
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-60.04 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-60.04 sec 21.5 GBytes 3.07 Gbits/sec receiver
———————————————————–
Server listening on 5201
By default the server will use TCP port 5201, if you intend to use some other port use “-p” switch
-p, –port n
set server port to listen on/connect to to n (default 5201)

On Client (192.169.173.7, 10.58.160.103)

# rpm -Uvh /tmp/iperf3-3.1.7-2.el7.x86_64.rpm
warning: /tmp/iperf3-3.1.7-2.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing. ################################# [100%]
Updating / installing.
1:iperf3-3.1.7-2.el7 ################################# [100%]
Explanation of the switches used:
-i, –interval n
pause n seconds between periodic bandwidth reports; default is 1, use 0 to disable

-w, –window n[KM]
window size / socket buffer size (this gets sent to the server and used on that side)

-t, –time n
time in seconds to transmit for (default 10 secs)

-c, –client host
run in client mode, connecting to the specified server

Run the below command wherein the IP with -c is the server IP (eth0)
client # iperf3 -i 10 -w 1M -t 60 -c 10.58.160.101
Connecting to host 10.58.160.101, port 5201
[ 4] local 10.58.160.103 port 40616 connected to 10.58.160.101 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-10.00 sec 1.27 GBytes 1.09 Gbits/sec 0 2.30 MBytes
[ 4] 10.00-20.00 sec 1.27 GBytes 1.09 Gbits/sec 0 2.30 MBytes
[ 4] 20.00-30.00 sec 1.27 GBytes 1.09 Gbits/sec 0 2.30 MBytes
[ 4] 30.00-40.00 sec 1.27 GBytes 1.09 Gbits/sec 0 2.30 MBytes
[ 4] 40.00-50.00 sec 1.27 GBytes 1.09 Gbits/sec 0 2.30 MBytes
[ 4] 50.00-60.00 sec 1.27 GBytes 1.09 Gbits/sec 0 2.30 MBytes
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-60.00 sec 7.63 GBytes 1.09 Gbits/sec 0 sender
[ 4] 0.00-60.00 sec 7.63 GBytes 1.09 Gbits/sec receiver

iperf Done.
Another attempt using a different interface (eth2)
client # iperf3 -i 10 -w 1M -t 60 -c 192.169.173.5
Connecting to host 192.169.173.5, port 5201
[ 4] local 192.169.173.7 port 35192 connected to 192.169.173.5 port 5201

[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-10.00 sec 3.56 GBytes 3.06 Gbits/sec 0 2.10 MBytes
[ 4] 10.00-20.00 sec 3.59 GBytes 3.08 Gbits/sec 0 2.10 MBytes
[ 4] 20.00-30.00 sec 3.59 GBytes 3.08 Gbits/sec 0 2.10 MBytes
[ 4] 30.00-40.00 sec 3.59 GBytes 3.08 Gbits/sec 0 2.10 MBytes
[ 4] 40.00-50.00 sec 3.59 GBytes 3.08 Gbits/sec 0 2.10 MBytes
[ 4] 50.00-60.00 sec 3.59 GBytes 3.08 Gbits/sec 0 2.10 MBytes
– – – – – – – – – – – – – – – – – – – – – – – – –
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-60.00 sec 21.5 GBytes 3.08 Gbits/sec 0 sender
[ 4] 0.00-60.00 sec 21.5 GBytes 3.08 Gbits/sec receiver

iperf Done.
Lets check the allowed bandwidth speed for each of this interface

The first attempt was done using eth0
# ethtool eth0 | grep Speed
Speed: 1000Mb/s
The second attempt was done using eth2
# ethtool eth2 | grep Speed
Speed: 3000Mb/s
So as we see the allowed bandwidth for eth0 was 1 Gb and we had a bandwidth speed of almost 1.09Gb/s

while for the other interface we had an allowed bandwidth of 3 Gb/s wherein the bandwidth throughput reached 3.08 Gb/s

How to use bmon to monitor network bandwidth on linux

Anthony Heddings
How to use bmon to monitor network bandwidth on linuxAnthony Heddings
Writer

Anthony Heddings is the resident cloud engineer for LifeSavvy Media, a technical writer, programmer, and an expert at Amazon’s AWS platform. He’s written hundreds of articles for How-To Geek and CloudSavvy IT that have been read millions of times. Read more.

How to use bmon to monitor network bandwidth on linux

As a server owner, it’s important to keep track of your network usage over time. Many hosting providers will charge for bandwidth and transmitted data, so you’ll want to keep tabs on your month-to-month usage.

Install vnstat

There are plenty of bandwidth monitoring tools out there—most real-time monitoring tools like htop and glances will show Rx (received) and Tx (transmitted) out. However, it’s much more useful to look at daily and monthly averages, and to do that, you’ll need a tool that can keep logs over time.

Of course, if you’re hosting your servers on a big cloud provider like AWS or GCP, they will probably have built-in log collection tools like AWS CloudWatch and GCP Cloud Monitoring. For a generic Linux solution though, you’ll want to install vnstat .

vnstat monitors all network interfaces, and keeps logs on how much traffic your servers are handling, which can be used to present monthly, daily, and hourly averages of traffic. It also has the option of outputting to a PNG for a better looking graph.

vnstat is available from most main package managers. For Debian-based systems like Ubuntu, that would be:

You’ll also want to install vnstati for image output:

If it isn’t available on your package manager, you can download it from source, and use make to build it for your system.

vnstat will immediately start collecting data, but it will take a while for enough data to be collected to actually present anything. Come back to it in a few hours once it’s collected some data, and run vnstat to view its output:

How to use bmon to monitor network bandwidth on linux

This shows received GiB (RX), and transmitted GiB (TX), as well as a total and an estimate based on prior usage if the logs are incomplete. Keep in mind that this is in Gibibytes, not Gigabytes, though the difference isn’t as much as the much smaller Gigabits.

If you want more detailed output, you can output hourly:

How to use bmon to monitor network bandwidth on linux

To output an image summary, you can use the following command ( -s for summary), replacing eth0 with whatever network device you want to view:

How to use bmon to monitor network bandwidth on linux

You can also view hourly output in the same fashion.

How to use bmon to monitor network bandwidth on linux

If you’d like to do more in-depth analysis, or send these logs off somewhere else, you can output all of vnstat ‘s logs with the –json flag.

How to use bmon to monitor network bandwidth on linux

Anthony Heddings
Anthony Heddings is the resident cloud engineer for LifeSavvy Media, a technical writer, programmer, and an expert at Amazon’s AWS platform. He’s written hundreds of articles for How-To Geek and CloudSavvy IT that have been read millions of times. Read Full Bio »