Support for stopping capture at specified capture file size or capture
[obnox/wireshark/wip.git] / doc / tethereal.pod.template
1
2 =head1 NAME
3
4 tethereal - Dump and analyze network traffic
5
6 =head1 SYNOPSYS
7
8 B<tethereal>
9 S<[ B<-a> capture autostop condition ] ...>
10 S<[ B<-c> count ]>
11 S<[ B<-D> ]>
12 S<[ B<-f> capture filter expression ]>
13 S<[ B<-F> file format ]>
14 S<[ B<-h> ]>
15 S<[ B<-i> interface ]> 
16 S<[ B<-l> ]>
17 S<[ B<-n> ]>
18 S<[ B<-N> resolving flags ]>
19 S<[ B<-o> preference setting ] ...>
20 S<[ B<-p> ]>
21 S<[ B<-r> infile ]>
22 S<[ B<-R> display filter expression ]>
23 S<[ B<-s> snaplen ]>
24 S<[ B<-t> time stamp format ]>
25 S<[ B<-v> ]>
26 S<[ B<-V> ]>
27 S<[ B<-w> savefile ]>
28 S<[ B<-x> ]>
29 S<[ filter expression ]>
30
31 =head1 DESCRIPTION
32
33 B<Tethereal> is a network protocol analyzer.  It lets you capture packet
34 data from a live network, or read packets from a previously saved
35 capture file, either printing a decoded form of those packets to the
36 standard output or writing the packets to a file.  B<Tethereal> knows
37 how to read B<libpcap> capture files, including those of B<tcpdump>.  In
38 addition, B<Tethereal> can read capture files from B<snoop> (including
39 B<Shomiti>) and B<atmsnoop>, B<LanAlyzer>, B<Sniffer> (compressed or
40 uncompressed), Microsoft B<Network Monitor>, AIX's B<iptrace>,
41 B<NetXray>, B<Sniffer Pro>, B<Etherpeek>, B<RADCOM>'s WAN/LAN analyzer,
42 B<Lucent/Ascend> router debug output, HP-UX's B<nettl>, the dump output
43 from B<Toshiba's> ISDN routers, the output from B<i4btrace> from the
44 ISDN4BSD project, the output in B<IPLog> format from the Cisco Secure
45 Intrusion Detection System, B<pppd logs> (pppdump format), the output
46 from VMS's B<TCPIPtrace> utility, and the text output from the
47 B<DBS Etherwatch> VMS utility.  There is no need to tell B<Tethereal>
48 what type of file you are reading; it will determine the file type by
49 itself.  B<Tethereal> is also capable of reading any of these file
50 formats if they are compressed using gzip.  B<Tethereal> recognizes this
51 directly from the file; the '.gz' extension is not required for this
52 purpose.
53
54 If the B<-w> flag is not specified, B<Tethereal> prints a decoded form
55 of the packets it captures or reads; otherwise, it writes those packets
56 to the file specified by that flag.
57
58 When printing a decoded form of packets, B<Tethereal> prints, by
59 default, a summary line containing the fields specified by the
60 preferences file (which are also the fields displayed in the packet list
61 pane in B<Ethereal>), although if it's printing packets as it captures
62 them, rather than printing packets from a saved capture file, it won't
63 print the "frame number" field.  If the B<-V> flag is specified, it
64 prints intead a protocol tree, showing all the fields of all protocols
65 in the packet.
66
67 When writing packets to a file, B<Tethereal>, by default, writes the
68 file in B<libpcap> format, and writes all of the packets it sees to the
69 output file.  The B<-F> flag can be used to specify the format in which
70 to write the file; it can write the file in B<libpcap> format (standard
71 B<libpcap> format, a modified format used by some patched versions of
72 B<libpcap>, or the format used by Red Hat Linux 6.1), B<snoop> format,
73 uncompressed B<Sniffer> format, Microsoft B<Network Monitor> 1.x format,
74 and the format used by Windows-based versions of the B<Sniffer>
75 software.
76
77 Read filters in B<Tethereal>, which allow you to select which packets
78 are to be decoded or written to a file, are very powerful; more fields
79 are filterable in B<Tethereal> than in other protocol analyzers, and the
80 syntax you can use to create your filters is richer.  As B<Tethereal>
81 progresses, expect more and more protocol fields to be allowed in read
82 filters.
83
84 Packet capturing is performed with the pcap library.  The capture filter
85 syntax follows the rules of the pcap library.  This syntax is different
86 from the read filter syntax.  A read filter can also be specified when
87 capturing, and only packets that pass the read filter will be displayed
88 or saved to the output file; note, however, that capture filters are much
89 more efficient than read filters, and it may be more difficult for
90 B<Tethereal> to keep up with a busy network if a read filter is
91 specified for a live capture.
92
93 Compressed file support uses (and therefore requires) the zlib library. 
94 If the zlib library is not present, B<Tethereal> will compile, but will
95 be unable to read compressed files.
96
97 A capture or read filter can either be specified with the B<-f> or B<-R>
98 option, respectively, in which case the entire filter expression must be
99 specified as a single argument (which means that if it contains spaces,
100 it must be quoted), or can be specified with command-line arguments
101 after the option arguments, in which case all the arguments after the
102 filter arguments are treated as a filter expression.  If the filter is
103 specified with command-line arguments after the option arguments, it's a
104 capture filter if a capture is being done (i.e., if no B<-r> flag was
105 specified) and a read filter if a capture file is being read (i.e., if a
106 B<-r> flag was specified).
107
108 =head1 OPTIONS
109
110 =over 4
111
112 =item -a
113
114 Specify a criterion that specifies when B<Tethereal> is to stop writing
115 to a capture file.  The criterion is of the form I<test>B<:>I<value>,
116 where I<test> is one of:
117
118 =for man .RS
119
120 =for html <P><DL>
121
122 =item duration
123
124 Stop writing to a capture file after I<value> seconds have elapsed.
125
126 =item filesize
127
128 Stop writing to a capture file after it reaches a size of I<value>
129 kilobytes (where a kilobyte is 1000 bytes, not 1024 bytes).
130
131 =for man .RE
132
133 =for html </DL>
134
135 =item -c
136
137 Sets the default number of packets to read when capturing live
138 data.
139
140 =item -D
141
142 Prints a list of the interfaces on which B<Tethereal> can capture, and
143 exits.  Note that "can capture" means that B<Tethereal> was able to open
144 that device to do a live capture; if, on your system, a program doing a
145 network capture must be run from an account with special privileges (for
146 example, as root), then, if B<Tethereal> is run with the B<-D> flag and
147 is not run from such an account, it will not list any interfaces.
148
149 =item -f
150
151 Sets the capture filter expression.
152
153 =item -F
154
155 Sets the file format of the output capture file.
156
157 =item -h
158
159 Prints the version and options and exits.
160
161 =item -i
162
163 Sets the name of the network interface to use for live packet capture. 
164 It should match one of the names listed in "B<netstat -i>" or
165 "B<ifconfig -a>".  If no interface is specified, B<Tethereal> searches
166 the list of interfaces, choosing the first non-loopback interface if
167 there are any non-loopback interfaces, and choosing the first loopback
168 interface if there are no non-loopback interfaces; if there are no
169 interfaces, B<Tethereal> reports an error and doesn't start the capture.
170
171 =item -l
172
173 Flush the standard output after the information for each packet is
174 printed.  (This is not, strictly speaking, line-buffered if B<-V>
175 was specified; however, it is the same as line-buffered if B<-V> wasn't
176 specified, as only one line is printed for each packet, and, as B<-l> is
177 normally used when piping a live capture to a program or script, so that
178 output for a packet shows up as soon as the packet is seen and
179 dissected, it should work just as well as true line-buffering.  We do
180 this as a workaround for a deficiency in the Microsoft Visual C++ C
181 library.)
182
183 This may be useful when piping the output of B<Tethereal> to another
184 program, as it means that the program to which the output is piped will
185 see the dissected data for a packet as soon as B<Tethereal> sees the
186 packet and generates that output, rather than seeing it only when the
187 standard output buffer containing that data fills up.
188
189 =item -n
190
191 Disables network object name resolution (such as hostname, TCP and UDP port
192 names).
193
194 =item -N
195
196 Turns on name resolving for particular types of addresses and port
197 numbers; the argument is a string that may contain the letters B<m> to
198 enable MAC address resolution, B<n> to enable network address
199 resolution, and B<t> to enable transport-layer port number resolution. 
200 This overrides B<-n> if both B<-N> and B<-n> are present.
201
202 =item -o
203
204 Sets a preference value, overriding the default value and any value read
205 from a preference file.  The argument to the flag is a string of the
206 form I<prefname>B<:>I<value>, where I<prefname> is the name of the
207 preference (which is the same name that would appear in the preference
208 file), and I<value> is the value to which it should be set.
209
210 =item -p
211
212 I<Don't> put the interface into promiscuous mode.  Note that the
213 interface might be in promiscuous mode for some other reason; hence,
214 B<-p> cannot be used to ensure that the only traffic that is captured is
215 traffic sent to or from the machine on which B<Tethereal> is running,
216 broadcast traffic, and multicast traffic to addresses received by that
217 machine.
218
219 =item -r
220
221 Reads packet data from I<infile>.
222
223 =item -R
224
225 Causes the specified filter (which uses the syntax of read filters,
226 rather than that of capture filters) to be applied before printing a
227 decoded form of packets or writing packets to a file; packets not
228 matching the filter are discarded rather than being printed or written.
229
230 =item -s
231
232 Sets the default snapshot length to use when capturing live data. 
233 No more than I<snaplen> bytes of each network packet will be read into
234 memory, or saved to disk.
235
236 =item -t
237
238 Sets the format of the packet timestamp printed in summary lines.  The
239 format can be one of 'r' (relative), 'a' (absolute), 'ad' (absolute with
240 date), or 'd' (delta).  The relative time is the time elapsed between
241 the first packet and the current packet.  The absolute time is the
242 actual time the packet was captured, with no date displayed; the
243 absolute date and time is the actual time and date the packet was
244 captured.  The delta time is the time since the previous packet was
245 captured.  The default is relative.
246
247 =item -v
248
249 Prints the version and exits.
250
251 =item -V
252
253 Causes B<Tethereal> to print a protocol tree for each packet rather than
254 a one-line summary of the packet.
255
256 =item -w
257
258 Writes packet data to I<savefile>.
259
260 =item -x
261
262 Causes B<Tethereal> to print a hex and ASCII dump of the packet data
263 after printing the summary or protocol tree.
264
265 =back
266
267 =head1 CAPTURE FILTER SYNTAX
268
269 See manual page of tcpdump(8).
270
271 =head1 READ FILTER SYNTAX
272
273 Read filters help you remove the noise from a packet trace and let you
274 see only the packets that interest you.  If a packet meets the
275 requirements expressed in your read filter, then it is printed.  Read
276 filters let you compare the fields within a protocol against a specific
277 value, compare fields against fields, and to check the existence of
278 specified fields or protocols.
279
280 The simplest read filter allows you to check for the existence of a
281 protocol or field.  If you want to see all packets which contain the IPX
282 protocol, the filter would be "ipx".  (Without the quotation marks) To
283 see all packets that contain a Token-Ring RIF field, use "tr.rif".
284
285 Fields can also be compared against values.  The comparison operators
286 can be expressed either through C-like symbols, or through English-like
287 abbreviations:
288
289     eq, ==    Equal
290     ne, !=    Not equal
291     gt, >     Greater than
292     lt, <     Less Than
293     ge, >=    Greater than or Equal to
294     le, <=    Less than or Equal to
295
296 Furthermore, each protocol field is typed. The types are:
297
298     Unsigned integer (either 8-bit, 16-bit, 24-bit, or 32-bit)
299     Signed integer (either 8-bit, 16-bit, 24-bit, or 32-bit)
300     Boolean
301     Ethernet address (6 bytes)
302     Byte string (n-number of bytes)
303     IPv4 address
304     IPv6 address
305     IPX network number
306     String (text)
307     Double-precision floating point number
308
309 An integer may be expressed in decimal, octal, or hexadecimal notation. 
310 The following three read filters are equivalent:
311
312     frame.pkt_len > 10
313     frame.pkt_len > 012
314     frame.pkt_len > 0xa
315
316 Boolean values are either true or false.  In a read filter expression
317 testing the value of a Boolean field, "true" is expressed as 1 or any
318 other non-zero value, and "false" is expressed as zero.  For example, a
319 token-ring packet's source route field is boolean.  To find any
320 source-routed packets, a read filter would be:
321
322     tr.sr == 1
323
324 Non source-routed packets can be found with:
325
326     tr.sr == 0
327
328 Ethernet addresses, as well as a string of bytes, are represented in hex
329 digits.  The hex digits may be separated by colons, periods, or hyphens:
330
331     fddi.dst eq ff:ff:ff:ff:ff:ff
332     ipx.srcnode == 0.0.0.0.0.1
333     eth.src == aa-aa-aa-aa-aa-aa
334
335 If a string of bytes contains only one byte, then it is represented as
336 an unsigned integer.  That is, if you are testing for hex value 'ff' in
337 a one-byte byte-string, you must compare it agains '0xff' and not 'ff'. 
338
339 IPv4 addresses can be represented in either dotted decimal notation, or
340 by using the hostname:
341
342     ip.dst eq www.mit.edu
343     ip.src == 192.168.1.1
344
345 IPv4 addresses can be compared with the same logical relations as numbers:
346 eq, ne, gt, ge, lt, and le.  The IPv4 address is stored in host order,
347 so you do not have to worry about how the endianness of an IPv4 address
348 when using it in a read filter.
349
350 Classless InterDomain Routing (CIDR) notation can be used to test if an
351 IPv4 address is in a certain subnet.  For example, this display filter
352 will find all packets in the 129.111 Class-B network:
353
354     ip.addr == 129.111.0.0/16
355
356 Remember, the number after the slash represents the number of bits used
357 to represent the network.  CIDR notation can also be used with
358 hostnames, in this example of finding IP addresses on the same Class C
359 network as 'sneezy':
360
361     ip.addr eq sneezy/24
362
363 The CIDR notation can only be used on IP addresses or hostnames, not in
364 variable names.  So, a display filter like "ip.src/24 == ip.dst/24" is
365 not valid.  (yet)
366
367 IPX networks are represented by unsigned 32-bit integers.  Most likely
368 you will be using hexadecimal when testing for IPX network values:
369
370     ipx.srcnet == 0xc0a82c00
371
372 A slice operator also exists.  You can check the substring
373 (byte-string) of any protocol or field.  For example, you can filter on
374 the vendor portion of an ethernet address (the first three bytes) like
375 this:
376
377     eth.src[0:3] == 00:00:83
378
379 If the length of your byte-slice is only one byte, then it is still
380 represented in hex, but without the preceding "0x": 
381
382     llc[3] == aa
383
384 You can use the slice operator on a protocol name, too.  And
385 remember, the "frame" protocol encompasses the entire packet, allowing
386 you to look at the nth byte of a packet regardless of its frame type
387 (Ethernet, token-ring, etc.).
388
389     token[0:5] ne 0.0.0.1.1
390     ipx[0:2] == ff:ff
391     llc[3:1] eq 0xaa
392
393 The following syntax governs slices:
394
395         [i:j]   i = start_offset, j = length
396         [i-j]   i = start_offet, j = end_offset, inclusive.
397         [i]     i = start_offset, length = 1
398         [:j]    start_offset = 0, length = j
399         [i:]    start_offset = i, end_offset = end_of_field
400
401 Offsets and lengths can be negative, in which case they indicate the
402 offset from the B<end> of the field.  Here's how to check the last 4
403 bytes of a frame:
404
405     frame[-4:4] == 0.1.2.3
406
407 or
408
409     frame[-4:] == 0.1.2.3
410
411 You can create complex concatenations of slices using the comma operator:
412
413         field[1,3-5,9:] == 01:03:04:05:09:0a:0b
414
415 All the above tests can be combined together with logical expressions. 
416 These too are expressable in C-like syntax or with English-like
417 abbreviations:
418
419     and, &&   Logical AND
420     or, ||    Logical OR
421     not, !    Logical NOT
422
423 Expressions can be grouped by parentheses as well.  The following are
424 all valid read filter expression:
425
426     tcp.port == 80 and ip.src == 192.168.2.1
427     not llc
428     (ipx.srcnet == 0xbad && ipx.srnode == 0.0.0.0.0.1) || ip
429     tr.dst[0:3] == 0.6.29 xor tr.src[0:3] == 0.6.29
430
431 A special caveat must be given regarding fields that occur more than
432 once per packet.  "ip.addr" occurs twice per IP packet, once for the
433 source address, and once for the destination address.  Likewise,
434 tr.rif.ring fields can occur more than once per packet.  The following
435 two expressions are not equivalent:
436
437         ip.addr ne 192.168.4.1
438     not ip.addr eq 192.168.4.1
439
440 The first filter says "show me all packets where an ip.addr exists that
441 does not equal 192.168.4.1".  That is, as long as one ip.addr in the
442 packet does not equal 192.168.44.1, the packet passes the display
443 filter.  The second filter "don't show me any packets that have at least
444 one ip.addr field equal to 192.168.4.1".  If one ip.addr is 192.168.4.1,
445 the packet does not pass.  If B<neither> ip.addr fields is 192.168.4.1,
446 then the packet passes.
447
448 It is easy to think of the 'ne' and 'eq' operators as having an implict
449 "exists" modifier when dealing with multiply-recurring fields.  "ip.addr
450 ne 192.168.4.1" can be thought of as "there exists an ip.addr that does
451 not equal 192.168.4.1".
452
453 Be careful with multiply-recurring fields; they can be confusing.
454
455 The following is a table of protocol and protocol fields that are
456 filterable in B<Tethereal>.  The abbreviation of the protocol or field is
457 given.  This abbreviation is what you use in the read filter.  The
458 type of the field is also given.
459
460 =insert_dfilter_table
461
462 =head1 FILES
463
464 The F<ethereal.conf> file, which is installed in the F<etc> directory
465 under the main installation directory (for example, F</usr/local/etc>)
466 on UNIX-compatible systems, and in the main installation directory (for
467 example, F<C:\Program Files\Ethereal>) on Windows systems, and the
468 personal preferences file, which is F<$HOME/.ethereal/preferences> on
469 UNIX-compatible systems and F<%APPDATA%\Ethereal\preferences> (or, if
470 %APPDATA% isn't defined,
471 F<%USERPROFILE%\Application Data\Ethereal\preferences>) on
472 Windows systems, contain system-wide and personal preference settings,
473 respectively.  The file contains preference settings of the form
474 I<prefname>B<:>I<value>, one per line, where I<prefname> is the name of
475 the preference (which is the same name that would appear in the
476 preference file), and I<value> is the value to which it should be set;
477 white space is allowed between B<:> and I<value>.  A preference setting
478 can be continued on subsequent lines by indenting the continuation lines
479 with white space.  A B<#> character starts a comment that runs to the
480 end of the line.
481
482 The system-wide preference file is read first, if it exists, overriding
483 B<Tethereal>'s default values; the personal preferences file is then
484 read, if it exists, overriding default values and values read from the
485 system-wide preference file.
486
487 The F<ethers> file, which is found in the F</etc> directory on
488 UNIX-compatible systems, and in the main installation directory (for
489 example, F<C:\Program Files\Ethereal>) on Windows systems, is consulted
490 to correlate 6-byte hardware addresses to names.  If an address is not
491 found in the F<ethers> file, the F<$HOME/.ethereal/ethers> file on
492 UNIX-compatible systems, and the F<%APPDATA%\Ethereal\ethers> file (or, if
493 %APPDATA% isn't defined, the
494 F<%USERPROFILE%\Application Data\Ethereal\ethers> file) on Windows
495 systems is consulted next.  Each line contains one hardware
496 address and name, separated by whitespace.  The digits of the hardware
497 address are separated by either a colon (:), a dash (-), or a period
498 (.).  The following three lines are valid lines of an ethers file:
499
500   ff:ff:ff:ff:ff:ff          Broadcast
501   c0-00-ff-ff-ff-ff          TR_broadcast
502   00.00.00.00.00.00          Zero_broadcast
503
504 The F<manuf> file, which is installed in the F<etc> directory under the
505 main installation directory (for example, F</usr/local/etc>) on
506 UNIX-compatible systems, and in the main installation directory (for
507 example, F<C:\Program Files\Ethereal>) on Windows systems, matches the
508 3-byte vendor portion of a 6-byte hardware address with the
509 manufacturer's name.  The format of the file is the same as the
510 F<ethers> file, except that each address is three bytes instead of six.
511
512 The F<ipxnets> file, which is found in the F</etc> directory on
513 UNIX-compatible systems, and in the main installation directory (for
514 example, F<C:\Program Files\Ethereal>) on Windows systems, correlates
515 4-byte IPX network numbers to names.  If a network number is not found
516 in the F<ipxnets> file, the F<$HOME/.ethereal/ipxnets> file on
517 UNIX-compatible systems, and the F<%APPDATA%\Ethereal\ipxnets> file (or,
518 if %APPDATA% isn't defined, the
519 F<%USERPROFILE%\Application Data\Ethereal\ipxnets> file)
520 on Windows systems, is consulted next.  The format is the same as the
521 F<ethers> file, except that each address if four bytes instead of six. 
522 Additionally, the address can be represented a single hexadecimal
523 number, as is more common in the IPX world, rather than four hex octets. 
524 For example, these four lines are valid lines of an ipxnets file.
525
526   C0.A8.2C.00              HR
527   c0-a8-1c-00              CEO
528   00:00:BE:EF              IT_Server1
529   110f                     FileServer3
530
531 =head1 SEE ALSO
532
533 L<ethereal(1)>, L<editcap(1)>, L<tcpdump(8)>, L<pcap(3)>
534
535 =head1 NOTES
536
537 B<Tethereal> is part of the B<Ethereal> distribution.  The latest version
538 of B<Ethereal> can be found at B<http://www.ethereal.com>.
539
540 =head1 AUTHORS
541
542 B<Tethereal> uses the same packet dissection code that B<Ethereal> does,
543 as well as using many other modules from B<Ethereal>; see the list of
544 authors in the B<Ethereal> man page for a list of authors of that code.