Viewing Live Bandwidth with iftop

iftop is a tool used to view current bandwidth activity on a network interface. It is considered to be for network usage, what ‘top’ is for CPU usage. iftop will monitor a given or default interface, and display a table current bandwidth usage between two hosts.

Installing iftop

To install iftop with yum, the EPEL repository must be installed.

Redhat / CentOS 5 (most likely version in use)

rpm -Uvh

rpm -Uvh

Redhat / CentOS 6

rpm -Uvh

rpm -Uvh

Now that the repository is installed to the server, we can install iftop

yum install iftop

Using iftop

iftop is a very simple tool to use. You simply need to supply the interface which should be monitored (eth0, eth1, etc). For the majority of users, this will just be the default ‘eth0’ interface. You can execute the command ‘ifconfig’ to view all interfaces.

iftop -i eth0

By default, iftop displays all traffic in [mega/kilo/giga]bits (little ‘b’) per second, as opposed to bytes (big ‘B’). To display in bytes rather than bits, specify the ‘-B’ switch.

iftop -i eth0 -B

iftop will also display all address with a hostname, if connecting host’s IP resolves to one. To have iftop always reports IPs regardless, use ‘-n’.

iftop -i eth0 -n

Additionally, the port in which traffic is occurring on is not displayed. To display this, use the -P and -N switches (-N will show a port number, rather than common name).

iftop -i eth0 -P -N

Leave a Reply

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

To submit solve the problem below * Time limit is exhausted. Please reload the CAPTCHA.