iftop.8 12 KB

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