Install IPTraf on a CentOS / RHEL / Fedora Linux To Get Network Statistics nixCraft Updated Tutorials/Posts

How can I install IPTraf on a CentOS / RHEL / Fedora Linux or Red Hat Enterprise Linux to get a variety information on my network?

IPTraf is a console-based network monitoring utility. IPTraf gathers data like TCP connection packet and byte counts, interface statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN station packet and byte counts. iptraf-ng is a fork of iptraf.

IPTraf features

It is a full screen and menu-driven app. You will see information on the IP traffic passing over your network. One can see IP, TCP, UDP, ICMP, non-IP and other IP packet counts, IP checksum errors, interface activity, packet size counts per interface. See the TCP and UDP counts of incoming and outgoing packets for common Linux applications and ports. You can easily discovers active hosts and shows statistics showing the data activity for them on your network. Let us see how to install IPTraf on a CentOS / RHEL / Fedora Linux and use it gather network statistics.

How to install IPTraf on a CentOS / RHEL / Fedora Linux

Type the following yum command to install IPTraf on a CentOS or RHEL or Oracle or Scientific Linux:
# yum install iptraf
# yum install iptraf-ng

Fedora Linux install IPTraf

Use the dnf command:
$ sudo dnf install iptraf-ng
$ sudo dnf install iptraf
Sample outputs:

Last metadata expiration check: 0:26:38 ago on Saturday 11 August 2018 06:09:09 PM IST.
Dependencies resolved.
================================================================================ Package Arch Version Repository Size
Installing: iptraf-ng x86_64 1.1.4-18.fc28 fedora 309 k Transaction Summary
Install 1 Package Total download size: 309 k
Installed size: 665 k
Is this ok [y/N]: y
Downloading Packages:
iptraf-ng-1.1.4-18.fc28.x86_64.rpm 188 kB/s | 309 kB 00:01 --------------------------------------------------------------------------------
Total 87 kB/s | 309 kB 00:03 Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction Preparing : 1/1 Installing : iptraf-ng-1.1.4-18.fc28.x86_64 1/1 Running scriptlet: iptraf-ng-1.1.4-18.fc28.x86_64 1/1 Verifying : iptraf-ng-1.1.4-18.fc28.x86_64 1/1 Installed: iptraf-ng.x86_64 1.1.4-18.fc28 Complete!

How do I use iptraf command?

The syntax is:

iptraf iptraf [options]
iptraf -i interface_name_here
iptraf-ng -i interface_name_here

To start the IP traffic monitor for eth0 interface type the following command. Pass the -i all option for all interfaces:
# iptraf-ng -i eth0
# iptraf-ng -i wlp4s0
# iptraf -i all

Sample outputs:

Fig.01: iptraf in action

Here is a quick preview of iptraf/iptraf-ng:

How to access all main menus

If the iptraf is started without any command-line options, the program comes up in interactive mode, with the various facilities accessed through the main menu as follows:
# iptraf
Sample outputs:

Fig.02: iptraf with menus

To start the general interface statistics, enter:

# iptraf -g
# iptraf-ng -g

To see the detailed statistics facility on an interface called eth0

# iptraf -d interface_name_here
# iptraf -d eth0
# iptraf-ng -d wlp4s0

To see the TCP and UDP monitor on an interface called eth0

# iptraf -z interface_name_here
# iptraf -s eth0
# iptraf-ng -s wlp4s0

To displays the packet size counts on an interface called eth0

# iptraf -z interface_name_here
# iptraf -z eth0
# iptraf-ng -z wlp4s0

Other options for iptraf-ng command

Here are other options for the program:

-l iface - start the LAN station monitor ("-l all" for all LAN interfaces)
-B - run in background (use only with one of the above parameters)
-t timeout - when used with one of the above parameters, tells the facility to run only for the specified number of minutes (timeout)
-L logfile - specifies an alternate log file for any direct invocation of a facility from the command line. The log is placed in /var/log/iptraf if path is not specified.
-I interval - specifies the log interval for all facilities except the IP traffic monitor. Value is in minutes.
-f - clear all locks and counters. Use with great caution. Normally used to recover from an abnormal termination.

Related media

This tutorial is also available in a quick video format:


Spread the love

Posted by News Monkey