4 mins read

How to monitor network bandwidth in Linux

Analyzing and monitoring network traffic of an entire network infrastructure is a very important task for all Linux system administrators. The network administrator needs to see what is happening with the network, who is using the bandwidth, and how their entire network infrastructure is handling the load. The good thing is that there are many open source network monitoring and traffic analysis tools available on Linux.

In this post, we will discuss some Linux command line tools that can be used to monitor network usage.

Discharge

Nload is a console application that allows users to monitor incoming and outgoing traffic separately.

Views incoming and outgoing traffic using two graphs and provides additional information such as total amount of data transferred and minimum/maximum network usage.

you can install nload by running the following command:

sudo apt-get install nload

Now run the nload command:

Once the nload command is executed, you should see the following output.

iptraf

Iptraf is an ncurses-based LAN IP monitoring tool that shows individual connections and the amount of data flowing between hosts.

Install iptrafeexecute the following:

sudo apt-get install iptraf

Once iptraf has been installed, issue the following command:

You should see the following result.

Vnstat

Vnstat is different from most other tools. It is a console-based network traffic monitor for Linux that runs as a daemon and keeps a log of network traffic for the selected interface. It can be used to generate a network usage report.

you can install vnstat by running the following command:

sudo apt-get install vnstat

Now, run vnstat without any arguments:

You can see the total amount of data transfer on your network.

If you want to monitor bandwidth usage in real time, use the -l option. It will show the total bandwidth used by incoming and outgoing data.

Now, run vnstat to monitor the bandwidth usage on the wlan0 interface:

You will see the following result.

Speedometer

Speedometer is a command line utility that can be used to monitor the current upload/download speeds of network connections and file system speeds. The speedometer displays a graph of your current and past network speed on your console. You can also use the speedometer directly on a file to monitor download performance and history for a specific download instead of all network traffic.

Run the following command to install speedometer on your system:

sudo apt-get install speedometer

Now, run speedometer on wlan0 interface:

sudo speedometer -r wlan0 -t wlan0

You will see output similar to the following.

Yes up

Iftop is a command line tool that listens to network traffic on a given interface (such as eth0, eth1, wlan0) and displays a table of the hosts’ current bandwidth usage. Iftop uses the pcap library to capture incoming and outgoing packets from the network interface.

You can easily install iftop by running the following command:

sudo apt-get install iftop

Now, run iftop with the n option that prevents iftop from resolving IP addresses to hostname:

You will see the following result.

Conclusion

I hope this post is helpful to quickly check the network bandwidth on your Linux server. Feel free to leave a comment if you have any questions.

How to Monitor Network Protocol Traffic on Linux Servers in Your Data Center

How to share printers between Windows, Mac and Linux PCs on a network

How to run a network speed test from a headless Linux server

How to find IP addresses on your network with Linux

How to enable TCP BBR to improve network speed on Linux

How Linux is taking over the network

How to use Netctl on Arch Linux to set up a network connection

How to Monitor Nvidia GPU on Linux

Linux real-time process monitor explained (above)

How to monitor your Linux server with Glances