My iftop's config file

Written by
Date: 2012-11-08 09:33:33 00:00

I use iftop a lot, with both my Linux and Mac computers. I always want to know who is using my bandwidth, specially when working on tethered 3G connections.

From the man page of iftop:

iftop listens to network traffic on a named interface, or on the first interface it can find which looks like an external interface if none is specified, and displays a table of current bandwidth usage by pairs of hosts. iftop must be run with sufficient permissions to monitor all network traffic on the interface; see pcap(3) for more information, but on most systems this means that it must be run as root.

You can pass options via the command line as usual with any unix-like command, but in the case of iftop you can also define a configuration file with the -c option. If you do not specify that option, the ~/.iftoprc file will be loaded by default if it exist.

interface: eth0 # The interface to monitor
log-scale: no # Use a logarithmic scale for bar graphs.
max-bandwidth: 2M # Fixes the maximum for the bar graph scale to bw, e.g. "10M". In bits
dns-resolution: yes # Controls reverse lookup of IP addresses.
port-display: on # Controls display of port numbers.
port-resolution: yes # Controls conversion of port numbers to service names.

I have max-bandwidth fixed to 2 Mbps because that is what I have in my ADSL. Believe it or not that is our reality in Bolivia. And I do not like logarithmic scale, I prefer linear one and fixed to what I have as max bandwidth.

I also like to know which ports are being used, and the name of those ports instead of their numbers when possible. DNS resolution is also a good one, as I want to know where my traffic is going to or coming from.

Then I just start iftop in any terminal window with

sudo iftop -c ~/iftop.conf