How to install iftop on Linux and monitoring Network traffic

How to install iftop on Linux
Posted on June 1, 2012 by Dan Nanni 4 Comments
iftop is a command line tool that shows a list of active network connections between local host and any remote host, sorted by their bandwidth usage. The list of top-ranking network connections (in terms of bandwidth usage) is periodically refreshed in a ncurses-based user interface. Using iftop, you can visually check the bidirectional bandwidth usage of different network connections in real time. In order to install iftop on Linux, follow the instructions below.

To install iftop on Ubuntu, Mint or Debian, run:

$ sudo apt-get install iftop
To install iftop on CentOS or RHEL, first set up Repoforge repository on your system, and then run the following command.

$ sudo yum install iftop
To install iftop on Fedora, simply run:

$ sudo yum install iftop
If you would like to build and install the latest version of iftop manually, do the following.

$ sudo yum -y install ncurses-devel libpcap-devel
$ wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz
$ tar xvfvz iftop-0.17.tar.gz
$ cd iftop-0.17
$ ./configure
$ make
$ sudo make install
Monitor Network Traffic in Real-Time with iftop

To monitor network traffic received on a specific network interface (e.g., eth0) with iftop, run the following command.

$ sudo iftop -i eth0
iftop supports rudimentary packet filtering rules with “-f” option. For example:

To monitor DNS traffic:

$ sudo iftop -i eth0 -f ‘port domain’
To monitor HTTP traffic:

$ sudo iftop -i eth0 -f ‘port http’
To monitor HTTP traffic while excluding a specific host:

$ sudo iftop -i eth0 -f ‘port http and not host 192.168.10.130’
To monitor network traffic while ignoring broadcast packets.

$ sudo iftop -i eth0 -f ‘not ether host ff:ff:ff:ff:ff:ff’
To monitor ICMP traffic:

$ sudo iftop -i eth0 -f ‘icmp’
The screenshot of iftop looks as follows.

Screenshot of iftop command

Advertisements
Leave a comment

Leave your opinion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: