5 Best Tools for monitoring network on your Linux server
There are many popular monitoring tools available in the market and we’ve analyzed the top 5 free network monitoring tools for Linux below:
1. Nload
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.
nload
Installing Nload – Fedora and Ubuntu have got it in the default repos. CentOS users need to get nload from Epel repositories.
# fedora or centos yum install nload -y # ubuntu/debian sudo apt-get install nload
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.
iftop -n
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.
# fedora or centos yum install iftop -y # ubuntu or debian apt-get install iftop
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
iptraf
Install iptraf
# Centos (base repo) yum install iptraf # fedora or centos (with epel) yum install iptraf-ng -y # ubuntu or debian apt-get install iptraf iptraf-ng
Build from source :
For Centos/RHEL (7.3, 7.4)
yum install gcc tar git wget ncurses-devel ncurses make
For Ubuntu (16.04, 17.10, 18.04)
apt-get update apt-get install gcc tar git wget libncurses5-dev libncurses5 make
Download and extract IPTraf
cd /usr/local/src wget https://github.com/hobinyoon/iptraf-3.0.0/archive/master.zip unzip master.zip
Build and install IPTraf
cd /usr/local/src/iptraf-3.0.0-master cp /usr/include/netinet/if_tr.h /usr/include/linux/ ./Setup
Set PATH variable
export PATH=$PATH:/usr/local/bin
Run IPTraf using the command below
/usr/local/bin/iptraf or iptraf
4. 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.
Install Bmon – Ubuntu, Debian and Fedora users can install from default repos. CentOS users need to setup repoforge, since its not available in Epel.
# ubuntu or debian apt-get install bmon # fedora or centos (from repoforge) yum install bmon
Bmon supports many options and is capable of producing reports in html format. Check the man page for more information
5. 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.
$ service vnstat status * vnStat daemon is running
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.
Install vnstat
# ubuntu or debian apt-get install vnstat # fedora or centos (from epel) yum install vnstat
How to install EPEL repo on centos OS :
yum install epel-release