Blame view

chris committed
chris committed
chris committed
.\" iftop.8:
chris committed
4 5 6 7 8 9
.\" Manual page for iftop.
.\" $Id$

chris committed
iftop - display bandwidth usage on an interface by host
chris committed
11 12

chris committed
\fBiftop\fP \fB-h\fP |
[\fB-nNpblP\fP] [\fB-u\fP \fIunit\fP] [\fB-i\fP \fIinterface\fP] [\fB-f\fP \fIfilter code\fP] [\fB-F\fP \fInet\fP/\fImask\fP]
[\fB-G\fP \fInet6\fP/\fImask6\fP]
chris committed
chris committed
17 18 19 20 21 22
\fBiftop\fP listens to network traffic on a named \fIinterface\fP, 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.
\fBiftop\fP must be run with sufficient permissions to monitor all network
traffic on the \fIinterface\fP; see \fBpcap\fP(3) for more information, but on
most systems this means that it must be run as root.
chris committed
23 24 25 26

By default, \fBiftop\fP will look up the hostnames associated with addresses it
finds in packets. This can cause substantial traffic of itself, and may result
in a confusing display. You may wish to suppress display of DNS traffic by
chris committed
using filter code such as \fBnot port domain\fP, or switch it off entirely,
pdw committed
by using the \fB-n\fP option or by pressing \fBr\fP when the program is running.
chris committed

chris committed
By default, \fBiftop\fP counts all IP packets that pass through the filter, and
chris committed
the direction of the packet is determined according to the direction the packet
is moving across the interface.  Using the \fB-F\fP option it is possible to
chris committed
get \fBiftop\fP to show packets entering and leaving a given network.  For
example, \fBiftop \-F\fP will analyse packets flowing in and
chris committed
out of the 10.* network.
pdw committed

chris committed
37 38 39 40 41 42 43 44 45
Some other filter ideas:
\fBnot ether host ff:ff:ff:ff:ff:ff\fP
Ignore ethernet broadcast packets.
\fBport http and not host \fP\\fP
Count web traffic only, unless it is being directed through a local web cache.
pdw committed
How much bandwidth are users wasting trying to figure out why the network is
chris committed
chris committed

chris committed
49 50 51 52 53 54

Print a summary of usage.
56 57 58 59
Don't do hostname lookups. 
Do not resolve port number to service names
chris committed
60 61 62 63 64
Run in promiscuous mode, so that traffic which does not pass directly through
the specified interface is also counted.
65 66 67
Turn on port display.
68 69 70 71
Display and count datagrams addressed to or from link-local IPv6 addresses.
The default is not to display that address category.
chris committed
Don't display bar graphs of traffic. 
chris committed
pdw committed
75 76 77
\fB-m\fP \fIlimit\fP
Set the upper limit for the bandwidth scale.  Specified as a number with a 'K', 'M' or 'G' suffix.
78 79 80
\fB-u\fP \fIbits\fP|\fIbytes\fP|\fIpackets\fP
Display bandwidth rates in the given unit (per second).
pdw committed
Synonym for \fB-u\fP \fIbits\fP.
pdw committed
chris committed
84 85 86 87 88 89 90
\fB-i\fP \fIinterface\fP
Listen to packets on \fIinterface\fP.
\fB-f\fP \fIfilter code\fP
Use \fIfilter code\fP to select the packets to count. Only IP packets are ever
counted, so the specified code is evaluated as \fB(\fP\fIfilter code\fP\fB) and ip\fP.
\fB-F\fP \fInet\fP/\fImask\fP
Specifies an IPv4 network for traffic analysis.  If specified, iftop will only
chris committed
93 94 95 96
include packets flowing in to or out of the given network, and packet direction
is determined relative to the network boundary, rather than to the interface.
You may specify \fImask\fP as a dotted quad, such as /, or as a
single number specifying the number of bits set in the netmask, such as /24.
pdw committed
98 99 100 101 102
\fB-G\fP \fInet6\fP/\fImask6\fP
Specifies an IPv6 network for traffic analysis. The value of \fImask6\fP can be
given as a prefix length or as a numerical address string for more compound
pdw committed
103 104
\fB-c\fP \fIconfig file\fP
Specifies an alternate config file.  If not specified, iftop will use
\fB~/.iftoprc\fP if it exists.  See below for a description of config files
pdw committed
106 107 108 109
\fB-t\fP \fItext output mode\fP
Use text interface without ncurses and print the output to STDOUT.

chris committed

chris committed
111 112 113

When running, \fBiftop\fP uses the whole screen to display network usage. At
pdw committed
the top of the display is a logarithmic scale for the bar graph which gives a
chris committed
visual indication of traffic.
chris committed
116 117 118

The main part of the display lists, for each pair of hosts, the rate at which
data has been sent and received over the preceding 2, 10 and 40 second
chris committed
119 120
intervals. The direction of data flow is indicated by arrows, <= and =>. For
chris committed
121 122

pdw committed
123 124  =>      1Kb  500b   100b
                 <=                       2Mb    2Mb    2Mb
chris committed
125 126 127 128 129 130

shows, on the first line, traffic from \\fP to
\\fP; in the preceding 2 seconds, this averaged 1Kbit/s,
around half that amount over the preceding 10s, and a fifth of that over the
whole of the last 40s. During each of those intervals, the data sent in the
chris committed
131 132
other direction was about 2Mbit/s. On the actual display, part of each line
is inverted to give a visual indication of the 10s average of traffic.
chris committed
133 134 135 136
You might expect to see something like this where host \fBfoo\fP is making
repeated HTTP requests to \fBbar\fP, which is sending data back which saturates
a 2Mbit/s link.

pdw committed
137 138
By default, the pairs of hosts responsible for the most traffic (10 second
average) are displayed at the top of the list.
chris committed

pdw committed
140 141 142
At the bottom of the display, various totals are shown, including peak traffic
over the last 40s, total traffic transferred (after filtering), and total
transfer rates averaged over 2s, 10s and 40s.
pdw committed

pdw committed
144 145

pdw committed
By pressing \fBs\fP or \fBd\fP while \fBiftop\fP is running, all traffic
pdw committed
147 148 149 150
for each source or destination will be aggregated together.  This is most
useful when \fBiftop\fP is run in promiscuous mode, or is run on a gateway

151 152 153

\fBS\fP or \fBD\fP toggle the display of source and destination ports
pdw committed
154 155
respectively. \fBp\fP will toggle port display on/off.

pdw committed
156 157 158 159 160 161

\fBt\fP cycles through the four line display modes; the default 2-line display,
with sent and received traffic on separate lines, and 3 1-line displays, with
sent, received, or total traffic shown.

pdw committed
162 163 164 165 166 167 168 169 170 171 172 173

By default, the display is ordered according to the 10s average (2nd column).
By pressing \fB1\fP, \fB2\fP or \fB3\fP it is possible to sort by the 1st, 2nd
or 3rd column.   By pressing \fB<\fP or \fB>\fP the display will be sorted by
source or destination hostname respectively.


\fBl\fP allows you to enter a POSIX extended regular expression that will be
used to filter hostnames shown in the display.  This is a good way to quickly
limit what is shown on the display.  Note that this happens at a much later
pdw committed
174 175
stage than filter code, and does not affect what is actually captured.  Display
filters DO NOT affect the totals at the bottom of the screen.
pdw committed
176 177

pdw committed
178 179

\fBP\fP will pause the current display.

pdw committed
181 182 183 184
\fBo\fP will freeze the current screen order.  This has the side effect that
traffic between hosts not shown on the screen at the time will not be shown at
all, although it will be included in the totals at the bottom of the screen.

pdw committed
185 186 187 188 189

\fBj\fP and \fBk\fP will scroll the display of hosts.  This feature is most
useful when the display order is frozen (see above).

pdw committed
190 191 192 193 194

\fBf\fP allows you to edit the filter code whilst iftop running.  This
can lead to some unexpected behaviour.

pdw committed
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232

iftop can read its configuration from a config file.  If the \fB-c\fP option is
not specified, iftop will attempt to read its configuration from
\fB~/.iftoprc\fP, if it exists.  Any command line options specified will
override settings in the config file.

The config file consists of one configuration directive per line.  Each
directive is a name value pair, for example:

interface: eth0

sets the network interface.  The following config directives are supported:

\fBinterface:\fP \fIif\fP
Sets the network interface to \fIif\fP.
\fBdns-resolution:\fP \fI(yes|no)\fP
Controls reverse lookup of IP addresses.
\fBport-resolution:\fP \fI(yes|no)\fP
Controls conversion of port numbers to service names.
\fBfilter-code:\fP \fIbpf\fP
Sets the filter code to \fIbpf\fP.
\fBshow-bars:\fP \fI(yes|no)\fP
Controls display of bar graphs.
\fBpromiscuous:\fP \fI(yes|no)\fP
Puts the interface into promiscuous mode.
\fBport-display:\fP \fI(off|source-only|destination-only|on)\fP
Controls display of port numbers.
233 234 235
\fBlink-local:\fP \fI(yes|no)\fP
Determines displaying of link-local IPv6 addresses.
pdw committed
236 237 238 239 240 241
\fBhide-source:\fP \fI(yes|no)\fP
Hides source host names.
\fBhide-destination:\fP \fI(yes|no)\fP
Hides destination host names.
242 243 244
\fBbandwidth-unit:\fP \fI(bits|bytes|packets)\fP
Use the specified unit for bandwidth display. The default is bits.
pdw committed
\fBuse-bytes:\fP \fI(yes|no)\fP
\fBuse-bytes: yes\fP is a synonym of \fBbandwidth-unit: packets\fP.
pdw committed
247 248 249 250 251 252 253 254
\fBsort:\fP \fI(2s|10s|40s|source|destination)\fP
Sets which column is used to sort the display.
\fBline-display:\fP \fI(two-line|one-line-both|one-line-sent|one-line-received)\fP
Controls the appearance of each item in the display.
\fBshow-totals:\fP \fI(yes|no)\fP
pdw committed
Shows cumulative total for each item.
pdw committed
256 257 258 259 260
\fBlog-scale:\fP \fI(yes|no)\fP
Use a logarithmic scale for bar graphs.
\fBmax-bandwidth:\fP \fIbw\fP
pdw committed
Fixes the maximum for the bar graph scale to \fIbw\fP, e.g. "10M". Note that the value has to always be in bits, regardless if the option to display in bytes has been chosen.
pdw committed
262 263 264 265
\fBnet-filter:\fP \fInet/mask\fP
Defines an IP network boundary for determining packet direction.
266 267 268
\fBnet-filter6:\fP \fInet6/mask6\fP
Defines an IPv6 network boundary for determining packet direction.
pdw committed
269 270 271
\fBscreen-filter:\fP \fIregexp\fP
Sets a regular expression to filter screen output.

pdw committed
272 273 274 275 276 277 278 279 280 281 282 283 284 285
.SH QUIRKS (aka they're features, not bugs)

There are some circumstances in which iftop may not do what you expect.  In
most cases what it is doing is logical, and we believe it is correct behaviour,
although I'm happy to hear reasoned arguments for alternative behaviour.

\fBTotals don't add up\fP

There are several reasons why the totals may not appear to add up.  The
most obvious is having a screen filter in effect, or screen ordering
frozen.  In this case some captured information is not being shown to
you, but is included in the totals.

A more subtle explanation comes about when running in promiscuous mode
without specifying a \fB-F\fP option.  In this case there is no easy way
pdw committed
287 288 289 290
to assign the direction of traffic between two third parties.  For the purposes
of the main display this is done in an arbitrary fashion (by ordering of IP
addresses), but for the sake of totals all traffic between other hosts is
accounted as incoming, because that's what it is from the point of view of your
interface.  The \fB-F\fP option allows you to specify an arbitrary network
pdw committed
boundary, and to show traffic flowing across it.
pdw committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308

\fBPeak totals don't add up\fP

Again, this is a feature.  The peak sent and peak received didn't necessarily
happen at the same time.  The peak total is the maximum of sent plus received
in each captured time division.

\fBChanging the filter code doesn't seem to work\fP

Give it time.  Changing the filter code affects what is captured from
the time that you entered it, but most of what is on the display is
based on some fraction of the last 40s window of capturing.  After
changing the filter there may be entries on the display that are
disallowed by the current filter for up to 40s.  DISPLAY FILTERING has
immediate effect and does not affect what is captured.

pdw committed
309 310 311 312 313 314

Configuration file for iftop.

chris committed
315 316 317
.BR tcpdump (8),
.BR pcap (3),
chris committed
.BR driftnet (1).
chris committed
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336

Paul Warren <>


This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

pdw committed
337 338 339
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
chris committed