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