How to install and use IPTraf in Linux

To install and use IPTraf Tool

IPTraf is an IP LAN monitoring tool based on ncurses, which is used to monitor connections such as UDP, TCP, ICMP, etc. Real Time Interactive IP LAN Monitoring with IPTraf Tool installation is explained in this manual.

To Install IPTraf

For Ubuntu

Run the following ‘ apt-get‘ command for its installation.

root@linuxhelp ~$ sudo apt-get install iptraf

For CentOS, RHEL and Fedora

IPTraf is part of the Linux distribution which can be installed on CentOS, RHEL, and Fedora server’ s by executing the following command.

[root@linuxhelp ~]# yum install iptraf -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
-->  Running transaction check
--->  Package iptraf-ng.x86_64 0:1.1.4-4.el7 will be installed
.
.
.
Installed:
  iptraf-ng.x86_64 0:1.1.4-4.el7                                                         

Complete!

Now the installation of IPTraf is completed.

Usage of IPTraf

In the terminal, execute the below command to start an ASCII based menu interface which will allow to see the present IP traffic monitoring, Detailed interface statistics, General interface statistics, Filters, Statistical breakdowns, and also gives some configure options.

[root@linuxhelp ~]# iptraf

A menu system is displayed by the iptraf interactive screen with various options to choose from. The real time interface statistics and IP traffic are shown in the following screenshots.

IP traffic monitor Screen

General interface statistics Screen

Detailed interface statistics Screen


Statistical breakdowns Screen

1. By packet size



2. By TCP/UDP port



LAN station monitor Screen


Filter Screen



Configuration Screen


Various Options for IPTraf

To start the IP traffic monitor on a specific interface, run “ iptraf -i” .

[root@linuxhelp ~]# iptraf -i eth0

Use the following command, to monitor TCP/UDP traffic on a particular interface.

[root@linuxhelp ~]# iptraf -s eth0

Tag : IPtraf
FAQ
Q
Why I get the error message "Unable to open raw socket" when using IPtraf?
A
you must be running version 2.2.x of the Linux kernel. Be sure to include it if you're compiling a custom kernel. The "Packet Socket" driver must be installed.
Q
How to configure IPTraf but it tells me only the first instance can configure?
A
By this command you can clear the Issue the iptraf command with the -f parameter.
Q
Is there any way to make IPTraf run in the background and collect statistics to a log file?
A
there was no elegant way of doing so. Version 2.1.0 and later have the -B command-line parameter to force IPTraf to dump all its screen output into oblivion and move into the background.
Q
Does IPTraf run on FreeBSD?
A
IPTraf was designed from the ground up to use the Linux

PF_PACKET mechanism, not libpcap.
Q
I try to start IPTraf but it tells me that is already active in another process?
A
Probably due to a faulty installation or abnormal termination. If you're sure you've installed the software properly, you may have stale lock files from a previous abort.