]> gitweb.fperrin.net Git - iftop.git/blob - iftop.8
gitignore
[iftop.git] / iftop.8
1 .TH IFTOP 8
2 .\"
3 .\" iftop.8:
4 .\" Manual page for iftop.
5 .\"
6 .\" $Id: iftop.8,v 1.31 2014/01/05 17:22:39 pdw Exp $
7 .\"
8
9 .SH NAME
10 iftop - display bandwidth usage on an interface by host
11
12 .SH SYNOPSIS
13 \fBiftop\fP \fB-h\fP |
14 [\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]
15 [\fB-G\fP \fInet6\fP/\fImask6\fP]
16 .SH DESCRIPTION
17 \fBiftop\fP listens to network traffic on a named \fIinterface\fP, or on the
18 first interface it can find which looks like an external interface if none is
19 specified, and displays a table of current bandwidth usage by pairs of hosts.
20 \fBiftop\fP must be run with sufficient permissions to monitor all network
21 traffic on the \fIinterface\fP; see \fBpcap\fP(3) for more information, but on
22 most systems this means that it must be run as root.
23
24 By default, \fBiftop\fP will look up the hostnames associated with addresses it
25 finds in packets. This can cause substantial traffic of itself, and may result
26 in a confusing display. You may wish to suppress display of DNS traffic by
27 using filter code such as \fBnot port domain\fP, or switch it off entirely,
28 by using the \fB-n\fP option or by pressing \fBr\fP when the program is running.
29
30 By default, \fBiftop\fP counts all IP packets that pass through the filter, and
31 the direction of the packet is determined according to the direction the packet
32 is moving across the interface.  Using the \fB-F\fP option it is possible to
33 get \fBiftop\fP to show packets entering and leaving a given network.  For
34 example, \fBiftop \-F 10.0.0.0/255.0.0.0\fP will analyse packets flowing in and
35 out of the 10.* network.
36
37 Some other filter ideas:
38 .TP
39 \fBnot ether host ff:ff:ff:ff:ff:ff\fP
40 Ignore ethernet broadcast packets.
41 .TP
42 \fBport http and not host \fP\fIwebcache.example.com\fP
43 Count web traffic only, unless it is being directed through a local web cache.
44 .TP
45 \fBicmp\fP
46 How much bandwidth are users wasting trying to figure out why the network is
47 slow?
48
49 .SH OPTIONS
50
51 .TP
52 \fB-h\fP
53 Print a summary of usage.
54 .TP
55 \fB-n\fP
56 Don't do hostname lookups. 
57 .TP
58 \fB-N\fP
59 Do not resolve port number to service names
60 .TP
61 \fB-p\fP
62 Run in promiscuous mode, so that traffic which does not pass directly through
63 the specified interface is also counted.
64 .TP
65 \fB-P\fP
66 Turn on port display.
67 .TP
68 \fB-l\fP
69 Display and count datagrams addressed to or from link-local IPv6 addresses.
70 The default is not to display that address category.
71 .TP
72 \fB-b\fP
73 Don't display bar graphs of traffic. 
74 .TP
75 \fB-m\fP \fIlimit\fP
76 Set the upper limit for the bandwidth scale.  Specified as a number with a 'K', 'M' or 'G' suffix.
77 .TP
78 \fB-u\fP \fIbits\fP|\fIbytes\fP|\fIpackets\fP
79 Display bandwidth rates in the given unit (per second).
80 .TP
81 \fB-B\fP
82 Synonym for \fB-u\fP \fIbits\fP.
83 .TP
84 \fB-i\fP \fIinterface\fP
85 Listen to packets on \fIinterface\fP.
86 .TP
87 \fB-f\fP \fIfilter code\fP
88 Use \fIfilter code\fP to select the packets to count. Only IP packets are ever
89 counted, so the specified code is evaluated as \fB(\fP\fIfilter code\fP\fB) and ip\fP.
90 .TP
91 \fB-F\fP \fInet\fP/\fImask\fP
92 Specifies an IPv4 network for traffic analysis.  If specified, iftop will only
93 include packets flowing in to or out of the given network, and packet direction
94 is determined relative to the network boundary, rather than to the interface.
95 You may specify \fImask\fP as a dotted quad, such as /255.255.255.0, or as a
96 single number specifying the number of bits set in the netmask, such as /24.
97 .TP
98 \fB-G\fP \fInet6\fP/\fImask6\fP
99 Specifies an IPv6 network for traffic analysis. The value of \fImask6\fP can be
100 given as a prefix length or as a numerical address string for more compound
101 bitmasking.
102 .TP
103 \fB-c\fP \fIconfig file\fP
104 Specifies an alternate config file.  If not specified, iftop will use
105 \fB~/.iftoprc\fP if it exists.  See below for a description of config files
106 .TP
107 \fB-t\fP \fItext output mode\fP
108 Use text interface without ncurses and print the output to STDOUT.
109
110
111 .SH DISPLAY
112
113 When running, \fBiftop\fP uses the whole screen to display network usage. At
114 the top of the display is a logarithmic scale for the bar graph which gives a
115 visual indication of traffic.
116
117 The main part of the display lists, for each pair of hosts, the rate at which
118 data has been sent and received over the preceding 2, 10 and 40 second
119 intervals. The direction of data flow is indicated by arrows, <= and =>. For
120 instance,
121 .nf
122
123 foo.example.com  =>  bar.example.com      1Kb  500b   100b
124                  <=                       2Mb    2Mb    2Mb
125
126 .fi
127 shows, on the first line, traffic from \fBfoo.example.com\fP to
128 \fBbar.example.com\fP; in the preceding 2 seconds, this averaged 1Kbit/s,
129 around half that amount over the preceding 10s, and a fifth of that over the
130 whole of the last 40s. During each of those intervals, the data sent in the
131 other direction was about 2Mbit/s. On the actual display, part of each line
132 is inverted to give a visual indication of the 10s average of traffic.
133 You might expect to see something like this where host \fBfoo\fP is making
134 repeated HTTP requests to \fBbar\fP, which is sending data back which saturates
135 a 2Mbit/s link.
136
137 By default, the pairs of hosts responsible for the most traffic (10 second
138 average) are displayed at the top of the list.
139
140 At the bottom of the display, various totals are shown, including peak traffic
141 over the last 40s, total traffic transferred (after filtering), and total
142 transfer rates averaged over 2s, 10s and 40s.
143
144 .SH SOURCE / DEST AGGREGATION
145
146 By pressing \fBs\fP or \fBd\fP while \fBiftop\fP is running, all traffic
147 for each source or destination will be aggregated together.  This is most
148 useful when \fBiftop\fP is run in promiscuous mode, or is run on a gateway
149 machine.
150
151 .SH PORT DISPLAY
152
153 \fBS\fP or \fBD\fP toggle the display of source and destination ports
154 respectively. \fBp\fP will toggle port display on/off.
155
156 .SH DISPLAY TYPE
157
158 \fBt\fP cycles through the four line display modes; the default 2-line display,
159 with sent and received traffic on separate lines, and 3 1-line displays, with
160 sent, received, or total traffic shown.
161
162 .SH DISPLAY ORDER
163
164 By default, the display is ordered according to the 10s average (2nd column).
165 By pressing \fB1\fP, \fB2\fP or \fB3\fP it is possible to sort by the 1st, 2nd
166 or 3rd column.   By pressing \fB<\fP or \fB>\fP the display will be sorted by
167 source or destination hostname respectively.
168
169 .SH DISPLAY FILTERING
170
171 \fBl\fP allows you to enter a POSIX extended regular expression that will be
172 used to filter hostnames shown in the display.  This is a good way to quickly
173 limit what is shown on the display.  Note that this happens at a much later
174 stage than filter code, and does not affect what is actually captured.  Display
175 filters DO NOT affect the totals at the bottom of the screen.
176
177 .SH PAUSE DISPLAY / FREEZE ORDER
178
179 \fBP\fP will pause the current display.
180
181 \fBo\fP will freeze the current screen order.  This has the side effect that
182 traffic between hosts not shown on the screen at the time will not be shown at
183 all, although it will be included in the totals at the bottom of the screen.
184
185 .SH SCROLL DISPLAY
186
187 \fBj\fP and \fBk\fP will scroll the display of hosts.  This feature is most
188 useful when the display order is frozen (see above).
189
190 .SH FILTER CODE
191
192 \fBf\fP allows you to edit the filter code whilst iftop running.  This
193 can lead to some unexpected behaviour.
194
195 .SH CONFIG FILE
196
197 iftop can read its configuration from a config file.  If the \fB-c\fP option is
198 not specified, iftop will attempt to read its configuration from
199 \fB~/.iftoprc\fP, if it exists.  Any command line options specified will
200 override settings in the config file.
201
202 The config file consists of one configuration directive per line.  Each
203 directive is a name value pair, for example:
204 .nf
205
206 interface: eth0
207
208 .fi
209 sets the network interface.  The following config directives are supported:
210
211 .TP
212 \fBinterface:\fP \fIif\fP
213 Sets the network interface to \fIif\fP.
214 .TP
215 \fBdns-resolution:\fP \fI(yes|no)\fP
216 Controls reverse lookup of IP addresses.
217 .TP
218 \fBport-resolution:\fP \fI(yes|no)\fP
219 Controls conversion of port numbers to service names.
220 .TP
221 \fBfilter-code:\fP \fIbpf\fP
222 Sets the filter code to \fIbpf\fP.
223 .TP
224 \fBshow-bars:\fP \fI(yes|no)\fP
225 Controls display of bar graphs.
226 .TP
227 \fBpromiscuous:\fP \fI(yes|no)\fP
228 Puts the interface into promiscuous mode.
229 .TP
230 \fBport-display:\fP \fI(off|source-only|destination-only|on)\fP
231 Controls display of port numbers.
232 .TP
233 \fBlink-local:\fP \fI(yes|no)\fP
234 Determines displaying of link-local IPv6 addresses.
235 .TP
236 \fBhide-source:\fP \fI(yes|no)\fP
237 Hides source host names.
238 .TP
239 \fBhide-destination:\fP \fI(yes|no)\fP
240 Hides destination host names.
241 .TP
242 \fBbandwidth-unit:\fP \fI(bits|bytes|packets)\fP
243 Use the specified unit for bandwidth display. The default is bits.
244 .TP
245 \fBuse-bytes:\fP \fI(yes|no)\fP
246 \fBuse-bytes: yes\fP is a synonym of \fBbandwidth-unit: packets\fP.
247 .TP
248 \fBsort:\fP \fI(2s|10s|40s|source|destination)\fP
249 Sets which column is used to sort the display.
250 .TP
251 \fBline-display:\fP \fI(two-line|one-line-both|one-line-sent|one-line-received)\fP
252 Controls the appearance of each item in the display.
253 .TP
254 \fBshow-totals:\fP \fI(yes|no)\fP
255 Shows cumulative total for each item.
256 .TP
257 \fBlog-scale:\fP \fI(yes|no)\fP
258 Use a logarithmic scale for bar graphs.
259 .TP
260 \fBmax-bandwidth:\fP \fIbw\fP
261 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.
262 .TP
263 \fBnet-filter:\fP \fInet/mask\fP
264 Defines an IP network boundary for determining packet direction.
265 .TP
266 \fBnet-filter6:\fP \fInet6/mask6\fP
267 Defines an IPv6 network boundary for determining packet direction.
268 .TP
269 \fBscreen-filter:\fP \fIregexp\fP
270 Sets a regular expression to filter screen output.
271
272 .SH QUIRKS (aka they're features, not bugs)
273
274 There are some circumstances in which iftop may not do what you expect.  In
275 most cases what it is doing is logical, and we believe it is correct behaviour,
276 although I'm happy to hear reasoned arguments for alternative behaviour.
277
278 \fBTotals don't add up\fP
279
280 There are several reasons why the totals may not appear to add up.  The
281 most obvious is having a screen filter in effect, or screen ordering
282 frozen.  In this case some captured information is not being shown to
283 you, but is included in the totals.
284
285 A more subtle explanation comes about when running in promiscuous mode
286 without specifying a \fB-F\fP option.  In this case there is no easy way
287 to assign the direction of traffic between two third parties.  For the purposes
288 of the main display this is done in an arbitrary fashion (by ordering of IP
289 addresses), but for the sake of totals all traffic between other hosts is
290 accounted as incoming, because that's what it is from the point of view of your
291 interface.  The \fB-F\fP option allows you to specify an arbitrary network
292 boundary, and to show traffic flowing across it.
293
294 \fBPeak totals don't add up\fP
295
296 Again, this is a feature.  The peak sent and peak received didn't necessarily
297 happen at the same time.  The peak total is the maximum of sent plus received
298 in each captured time division.
299
300 \fBChanging the filter code doesn't seem to work\fP
301
302 Give it time.  Changing the filter code affects what is captured from
303 the time that you entered it, but most of what is on the display is
304 based on some fraction of the last 40s window of capturing.  After
305 changing the filter there may be entries on the display that are
306 disallowed by the current filter for up to 40s.  DISPLAY FILTERING has
307 immediate effect and does not affect what is captured.
308
309 .SH FILES
310
311 .TP
312 \fB~/.iftoprc\fP
313 Configuration file for iftop.
314
315 .SH SEE ALSO
316 .BR tcpdump (8),
317 .BR pcap (3),
318 .BR driftnet (1).
319
320 .SH AUTHOR
321 Paul Warren <pdw@ex-parrot.com>
322
323 .SH VERSION
324 $Id: iftop.8,v 1.31 2014/01/05 17:22:39 pdw Exp $
325
326 .SH COPYING
327 This program is free software; you can redistribute it and/or modify
328 it under the terms of the GNU General Public License as published by
329 the Free Software Foundation; either version 2 of the License, or
330 (at your option) any later version.
331
332 This program is distributed in the hope that it will be useful,
333 but WITHOUT ANY WARRANTY; without even the implied warranty of
334 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
335 GNU General Public License for more details.
336
337 You should have received a copy of the GNU General Public License along
338 with this program; if not, write to the Free Software Foundation, Inc.,
339 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
340