How To Monitor Network Bandwidth On Linux
Monitoring your network is a good way to protect yourself. By doing keeping track of your network activity, you’ll easily be able to detect issues at a moments notice. In this guide, we will be going over two excellent tools you can use to monitor network bandwidth on Linux.
1. Bmon
Bmon is a basic bandwidth and traffic estimation tool for Linux. Its barebones and can show you information on packet transfer rates.
The program is available on many Linux distributions. You can open up a terminal and use your distribution’s package manager to get the app working.
Ubuntu
sudo apt install bmon
Debian
sudo apt-get install bmon
Arch Linux
Users can install Bmon on Arch Linux via the “Community” software repository. If you don’t have this software source set up in Arch Linux, do the following.
Step 1: Open /etc/pacman.conf in the Nano text editor.
sudo nano -w /etc/pacman.conf
Step 2: Scroll down, remove # from in front of “Community” and the two lines that are under it.
Step 3: Save the edits with Ctrl + O and exit Nano with Ctrl + X.
Step 4: Re-sync your Arch package manager with the Pacman command.
sudo pacman -Syyu
After the community software source is set up, you’ll be able to install Bmon on Arch Linux.
sudo pacman -S bmon
Fedora
sudo dnf install bmon -y
OpenSUSE
sudo zypper install bmon
Monitor Network Bandwidth
The Bmon network tool detects traffic by running in the background in real time. Launch a terminal and execute the bmon command to start the monitoring process.
bmon
Once Bmon is open, use the arrow keys to select your default network device and select the Enter key. Not sure what your network device is? Open up a second terminal and run:
ip link show
Find your network card and return to Bmon to select it in the terminal interface.
Note: ethernet cards usually start with “enp,” or “eth.” Wireless cards use labels that start with “wlp,” or “wlan.”
When the network card that you use to interact with your local LAN and the internet is connected, you’ll start seeing information about your network.
Understanding Network Traffic
Now that the Bmon tool is up and running, it’ll start watching the network card you selected. The application shows network traffic in two graphs: RX (packets received) and TX (packets transmitted).
As each packet is sent (or received), you’ll see a blip on the graphs, measured in bytes per second. By looking at the graphs, you can determine how fast you are sending and receiving data to the internet, and your LAN gateway.
More Information
By default, the Bmon tool offers up some very basic information on packet transmission and receiving. This kind of information is useful. However, it doesn’t tell the whole story.
If you’re in need of more information, you’ll need to tap the d button on your keyboard. When you tap the “d” key, you’ll see much more information regarding your network connection.
2. Iptraf
Bmon is good at showing a very barebones analysis of traffic. That said, if you want more information about the packets going in and out of your Linux PC, you need to use IPtraf.
Ubuntu
sudo apt install iptraf
Debian
sudo apt-get install iptraf
Arch Linux
sudo pacman -S iptraf
Fedora sudo dnf install iptraf -y
OpenSUSE
sudo zypper install iptraf
Monitor Network Bandwidth
Now that the IPtraf tool is set up on your Linux system, the program is ready to use. To launch it, open a terminal and enter one of the commands below.
sudo iptraf-ng
or sudo iptraf
IP bandwidth
IPtraf is excellent at monitoring and showing detailed network statistics. It can show things like packet rates, and even IP traffic.
To view the IP monitor, select “IP traffic monitor” with the Enter key on the keyboard.
In the IPTraf monitor tool, you’ll be able to sort through different connections and view the packets they send in and out.
For more information on the individual connections that appear in this window, press M.
Interface Stats
Aside from giving information to the user about incoming and outgoing TCP connections, IPtraf has an excellent device monitor too.
To view the statistics of a specific network device, launch IPTraf, then select “Detailed interface statistics.”
In the Detailed interface statistics window, use the arrow keys and select the network device you’d like to monitor. In the monitor tool, IPTraf will show real-time information about incoming and outgoing statistics for both IPv4 and IPv6.