Install IPTraf on a CentOS / RHEL / Fedora Linux To Get Network Statistics

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
OR
# yum install iptraf-ng

Fedora Linux install IPTraf

Use the dnf command:
$ sudo dnf install iptraf-ng
OR
$ 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:

See also
  • Man page – iptraf(8)
  • IPtraf-ng home page
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • A lazy boy from Ireland May 15, 2014 @ 13:37

    Excellento. Installed it on a CentOS 6.x. Worked like a charm.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.