forked from srix/iftopcolor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iftop.cat
332 lines (230 loc) · 15.2 KB
/
iftop.cat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
IFTOP(8) IFTOP(8)
-e .pl 1100i
NNAAMMEE
iftop - display bandwidth usage on an interface by host
SSYYNNOOPPSSIISS
iiffttoopp --hh | [--nnNNppbbllBBPP] [--ii _i_n_t_e_r_f_a_c_e] [--ff _f_i_l_t_e_r _c_o_d_e] [--FF _n_e_t/_m_a_s_k] [--GG
_n_e_t_6/_m_a_s_k_6]
DDEESSCCRRIIPPTTIIOONN
iiffttoopp listens to network traffic on a named _i_n_t_e_r_f_a_c_e, 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. iiffttoopp must be run with sufficient permissions to monitor all
network traffic on the _i_n_t_e_r_f_a_c_e; see ppccaapp(3) for more information, but
on most systems this means that it must be run as root.
By default, iiffttoopp 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 using filter code such as nnoott ppoorrtt ddoommaaiinn, or switch it
off entirely, by using the --nn option or by pressing rr when the program
is running.
By default, iiffttoopp counts all IP packets that pass through the filter,
and the direction of the packet is determined according to the direc-
tion the packet is moving across the interface. Using the --FF option it
is possible to get iiffttoopp to show packets entering and leaving a given
network. For example, iiffttoopp --FF 1100..00..00..00//225555..00..00..00 will analyse packets
flowing in and out of the 10.* network.
Some other filter ideas:
nnoott eetthheerr hhoosstt ffff::ffff::ffff::ffff::ffff::ffff
Ignore ethernet broadcast packets.
ppoorrtt hhttttpp aanndd nnoott hhoosstt _w_e_b_c_a_c_h_e_._e_x_a_m_p_l_e_._c_o_m
Count web traffic only, unless it is being directed through a
local web cache.
iiccmmpp How much bandwidth are users wasting trying to figure out why
the network is slow?
OOPPTTIIOONNSS
--hh Print a summary of usage.
--nn Don't do hostname lookups.
--NN Do not resolve port number to service names
--pp Run in promiscuous mode, so that traffic which does not pass
directly through the specified interface is also counted.
--PP Turn on port display.
--ll Display and count datagrams addressed to or from link-local IPv6
addresses. The default is not to display that address category.
--bb Don't display bar graphs of traffic.
--BB Display bandwidth rates in bytes/sec rather than bits/sec.
--ii _i_n_t_e_r_f_a_c_e
Listen to packets on _i_n_t_e_r_f_a_c_e.
--ff _f_i_l_t_e_r _c_o_d_e
Use _f_i_l_t_e_r _c_o_d_e to select the packets to count. Only IP packets
are ever counted, so the specified code is evaluated as ((_f_i_l_t_e_r
_c_o_d_e)) aanndd iipp.
--FF _n_e_t/_m_a_s_k
Specifies an IPv4 network for traffic analysis. If specified,
iftop will only 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 _m_a_s_k as a dotted quad, such as /255.255.255.0, or as a
single number specifying the number of bits set in the netmask,
such as /24.
--GG _n_e_t_6/_m_a_s_k_6
Specifies an IPv6 network for traffic analysis. The value of
_m_a_s_k_6 can be given as a prefix length or as a numerical address
string for more compound bitmasking.
--cc _c_o_n_f_i_g _f_i_l_e
Specifies an alternate config file. If not specified, iftop
will use ~~//..iiffttoopprrcc if it exists. See below for a description
of config files
DDIISSPPLLAAYY
When running, iiffttoopp uses the whole screen to display network usage. At
the top of the display is a logarithmic scale for the bar graph which
gives a visual indication of traffic.
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 intervals. The direction of data flow is indicated by arrows, <=
and =>. For instance,
foo.example.com => bar.example.com 1Kb 500b 100b
<= 2Mb 2Mb 2Mb
shows, on the first line, traffic from ffoooo..eexxaammppllee..ccoomm to bbaarr..eexxaamm--
ppllee..ccoomm; 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
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. You might expect to see something like this where host ffoooo is
making repeated HTTP requests to bbaarr, which is sending data back which
saturates a 2Mbit/s link.
By default, the pairs of hosts responsible for the most traffic (10
second average) are displayed at the top of the list.
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.
SSOOUURRCCEE // DDEESSTT AAGGGGRREEGGAATTIIOONN
By pressing ss or dd while iiffttoopp is running, all traffic for each source
or destination will be aggregated together. This is most useful when
iiffttoopp is run in promiscuous mode, or is run on a gateway machine.
PPOORRTT DDIISSPPLLAAYY
SS or DD toggle the display of source and destination ports respectively.
pp will toggle port display on/off.
DDIISSPPLLAAYY TTYYPPEE
tt cycles through the four line display modes; the default 2-line dis-
play, with sent and received traffic on separate lines, and 3 1-line
displays, with sent, received, or total traffic shown.
DDIISSPPLLAAYY OORRDDEERR
By default, the display is ordered according to the 10s average (2nd
column). By pressing 11, 22 or 33 it is possible to sort by the 1st, 2nd
or 3rd column. By pressing << or >> the display will be sorted by
source or destination hostname respectively.
DDIISSPPLLAAYY FFIILLTTEERRIINNGG
ll 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 stage than filter code, and does not affect what is actu-
ally captured. Display filters DO NOT affect the totals at the bottom
of the screen.
PPAAUUSSEE DDIISSPPLLAAYY // FFRREEEEZZEE OORRDDEERR
PP will pause the current display.
oo 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.
SSCCRROOLLLL DDIISSPPLLAAYY
jj and kk will scroll the display of hosts. This feature is most useful
when the display order is frozen (see above).
FFIILLTTEERR CCOODDEE
ff allows you to edit the filter code whilst iftop running. This can
lead to some unexpected behaviour.
CCOONNFFIIGG FFIILLEE
iftop can read its configuration from a config file. If the --cc option
is not specified, iftop will attempt to read its configuration from
~~//..iiffttoopprrcc, 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 sup-
ported:
iinntteerrffaaccee:: _i_f
Sets the network interface to _i_f.
ddnnss--rreessoolluuttiioonn:: _(_y_e_s_|_n_o_)
Controls reverse lookup of IP addresses.
ppoorrtt--rreessoolluuttiioonn:: _(_y_e_s_|_n_o_)
Controls conversion of port numbers to service names.
ffiilltteerr--ccooddee:: _b_p_f
Sets the filter code to _b_p_f.
sshhooww--bbaarrss:: _(_y_e_s_|_n_o_)
Controls display of bar graphs.
pprroommiissccuuoouuss:: _(_y_e_s_|_n_o_)
Puts the interface into promiscuous mode.
ppoorrtt--ddiissppllaayy:: _(_o_f_f_|_s_o_u_r_c_e_-_o_n_l_y_|_d_e_s_t_i_n_a_t_i_o_n_-_o_n_l_y_|_o_n_)
Controls display of port numbers.
lliinnkk--llooccaall:: _(_y_e_s_|_n_o_)
Determines displaying of link-local IPv6 addresses.
hhiiddee--ssoouurrccee:: _(_y_e_s_|_n_o_)
Hides source host names.
hhiiddee--ddeessttiinnaattiioonn:: _(_y_e_s_|_n_o_)
Hides destination host names.
uussee--bbyytteess:: _(_y_e_s_|_n_o_)
Use bytes for bandwidth display, rather than bits.
ssoorrtt:: _(_2_s_|_1_0_s_|_4_0_s_|_s_o_u_r_c_e_|_d_e_s_t_i_n_a_t_i_o_n_)
Sets which column is used to sort the display.
lliinnee--ddiissppllaayy:: _(_t_w_o_-_l_i_n_e_|_o_n_e_-_l_i_n_e_-_b_o_t_h_|_o_n_e_-_l_i_n_e_-_s_e_n_t_|_o_n_e_-_l_i_n_e_-_r_e_c_e_i_v_e_d_)
Controls the appearance of each item in the display.
sshhooww--ttoottaallss:: _(_y_e_s_|_n_o_)
Shows cumulative total for each item.
lloogg--ssccaallee:: _(_y_e_s_|_n_o_)
Use a logarithmic scale for bar graphs.
mmaaxx--bbaannddwwiiddtthh:: _b_w
Fixes the maximum for the bar graph scale to _b_w, e.g. "10M".
Note that the value has to always be in bits, regardless if the
option to display in bytes has been chosen.
nneett--ffiilltteerr:: _n_e_t_/_m_a_s_k
Defines an IP network boundary for determining packet direction.
nneett--ffiilltteerr66:: _n_e_t_6_/_m_a_s_k_6
Defines an IPv6 network boundary for determining packet direc-
tion.
ssccrreeeenn--ffiilltteerr:: _r_e_g_e_x_p
Sets a regular expression to filter screen output.
QQUUIIRRKKSS ((aakkaa tthheeyy''rree ffeeaattuurreess,, nnoott bbuuggss))
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 alterna-
tive behaviour.
TToottaallss ddoonn''tt aadddd uupp
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 --FF option. In this case there is no easy way 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 --FF option allows you to
specify an arbitrary network boundary, and to show traffic flowing
across it.
PPeeaakk ttoottaallss ddoonn''tt aadddd uupp
Again, this is a feature. The peak sent and peak received didn't nec-
essarily happen at the same time. The peak total is the maximum of
sent plus received in each captured time division.
CChhaannggiinngg tthhee ffiilltteerr ccooddee ddooeessnn''tt sseeeemm ttoo wwoorrkk
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 disal-
lowed by the current filter for up to 40s. DISPLAY FILTERING has imme-
diate effect and does not affect what is captured.
FFIILLEESS
~~//..iiffttoopprrcc
Configuration file for iftop.
SSEEEE AALLSSOO
ttccppdduummpp(8), ppccaapp(3), ddrriiffttnneett(1).
AAUUTTHHOORR
Paul Warren <[email protected]>
VVEERRSSIIOONN
$Id: iftop.8,v 1.27 2010/11/27 11:06:12 pdw Exp $
CCOOPPYYIINNGG
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 MER-
CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
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.,
675 Mass Ave, Cambridge, MA 02139, USA.
(nlu+10
IFTOP(8)