1TCPDUMP(8)                  System Manager's Manual                 TCPDUMP(8)
2
3
4

NAME

6       tcpdump - dump traffic on a network
7

SYNOPSIS

9       tcpdump [ -AbdDefhHIJKlLnNOpqStuUvxX# ] [ -B buffer_size ]
10               [ -c count ]
11               [ -C file_size ] [ -G rotate_seconds ] [ -F file ]
12               [ -i interface ] [ -j tstamp_type ] [ -m module ] [ -M secret ]
13               [ --number ] [ -Q in|out|inout ]
14               [ -r file ] [ -V file ] [ -s snaplen ] [ -T type ] [ -w file ]
15               [ -W filecount ]
16               [ -E spi@ipaddr algo:secret,...  ]
17               [ -y datalinktype ] [ -z postrotate-command ] [ -Z user ]
18               [ --time-stamp-precision=tstamp_precision ]
19               [ --immediate-mode ] [ --version ]
20               [ expression ]
21

DESCRIPTION

23       Tcpdump  prints  out a description of the contents of packets on a net‐
24       work interface that match the boolean expression;  the  description  is
25       preceded  by a time stamp, printed, by default, as hours, minutes, sec‐
26       onds, and fractions of a second since midnight.  It  can  also  be  run
27       with the -w flag, which causes it to save the packet data to a file for
28       later analysis, and/or with the -r flag, which causes it to read from a
29       saved packet file rather than to read packets from a network interface.
30       It can also be run with the -V flag, which causes it to read a list  of
31       saved  packet  files.  In all cases, only packets that match expression
32       will be processed by tcpdump.
33
34       Tcpdump will, if not run with the -c flag, continue  capturing  packets
35       until  it is interrupted by a SIGINT signal (generated, for example, by
36       typing your interrupt character, typically control-C) or a SIGTERM sig‐
37       nal  (typically generated with the kill(1) command); if run with the -c
38       flag, it will capture packets until it is interrupted by  a  SIGINT  or
39       SIGTERM signal or the specified number of packets have been processed.
40
41       When tcpdump finishes capturing packets, it will report counts of:
42
43              packets ``captured'' (this is the number of packets that tcpdump
44              has received and processed);
45
46              packets ``received by filter'' (the meaning of this  depends  on
47              the  OS on which you're running tcpdump, and possibly on the way
48              the OS was configured - if a filter was specified on the command
49              line,  on some OSes it counts packets regardless of whether they
50              were matched by the filter expression and,  even  if  they  were
51              matched  by the filter expression, regardless of whether tcpdump
52              has read and processed them yet, on other OSes  it  counts  only
53              packets that were matched by the filter expression regardless of
54              whether tcpdump has read and processed them yet,  and  on  other
55              OSes  it  counts  only  packets  that were matched by the filter
56              expression and were processed by tcpdump);
57
58              packets ``dropped by kernel'' (this is  the  number  of  packets
59              that  were dropped, due to a lack of buffer space, by the packet
60              capture mechanism in the OS on which tcpdump is running, if  the
61              OS  reports that information to applications; if not, it will be
62              reported as 0).
63
64       On platforms that  support  the  SIGINFO  signal,  such  as  most  BSDs
65       (including  Mac  OS  X)  and  Digital/Tru64  UNIX, it will report those
66       counts when it receives a SIGINFO signal (generated,  for  example,  by
67       typing your ``status'' character, typically control-T, although on some
68       platforms, such as Mac OS X, the ``status'' character  is  not  set  by
69       default,  so  you must set it with stty(1) in order to use it) and will
70       continue capturing packets. On platforms that do not support  the  SIG‐
71       INFO signal, the same can be achieved by using the SIGUSR1 signal.
72
73       Reading packets from a network interface may require that you have spe‐
74       cial privileges; see the pcap (3PCAP) man page for details.  Reading  a
75       saved packet file doesn't require special privileges.
76

OPTIONS

78       -A     Print each packet (minus its link level header) in ASCII.  Handy
79              for capturing web pages.
80
81       -b     Print the AS number in BGP packets in ASDOT notation rather than
82              ASPLAIN notation.
83
84       -B buffer_size
85       --buffer-size=buffer_size
86              Set  the operating system capture buffer size to buffer_size, in
87              units of KiB (1024 bytes).
88
89       -c count
90              Exit after receiving count packets.
91
92       -C file_size
93              Before writing a raw packet to a  savefile,  check  whether  the
94              file  is  currently  larger than file_size and, if so, close the
95              current savefile and open a new one.  Savefiles after the  first
96              savefile  will  have the name specified with the -w flag, with a
97              number after it, starting at 1 and continuing upward.  The units
98              of  file_size  are  millions  of  bytes  (1,000,000  bytes,  not
99              1,048,576 bytes).
100
101              Note that when used with -Z option (enabled by default),  privi‐
102              leges are dropped before opening first savefile.
103
104       -d     Dump  the compiled packet-matching code in a human readable form
105              to standard output and stop.
106
107       -dd    Dump packet-matching code as a C program fragment.
108
109       -ddd   Dump packet-matching code as decimal numbers  (preceded  with  a
110              count).
111
112       -D
113       --list-interfaces
114              Print the list of the network interfaces available on the system
115              and on which tcpdump can  capture  packets.   For  each  network
116              interface,  a number and an interface name, possibly followed by
117              a text description of the interface, is printed.  The  interface
118              name  or the number can be supplied to the -i flag to specify an
119              interface on which to capture.
120
121              This can be useful on systems that don't have a command to  list
122              them  (e.g.,  Windows  systems, or UNIX systems lacking ifconfig
123              -a); the number can be useful on Windows 2000 and later systems,
124              where the interface name is a somewhat complex string.
125
126              The  -D  flag will not be supported if tcpdump was built with an
127              older version of libpcap that lacks the pcap_findalldevs() func‐
128              tion.
129
130       -e     Print  the  link-level  header  on  each dump line.  This can be
131              used, for example, to print MAC layer  addresses  for  protocols
132              such as Ethernet and IEEE 802.11.
133
134       -E     Use spi@ipaddr algo:secret for decrypting IPsec ESP packets that
135              are addressed to addr and contain Security Parameter Index value
136              spi. This combination may be repeated with comma or newline sep‐
137              aration.
138
139              Note that setting the secret for IPv4 ESP packets  is  supported
140              at this time.
141
142              Algorithms  may  be  des-cbc,  3des-cbc,  blowfish-cbc, rc3-cbc,
143              cast128-cbc, or none.  The default is des-cbc.  The  ability  to
144              decrypt  packets  is  only  present if tcpdump was compiled with
145              cryptography enabled.
146
147              secret is the ASCII text for ESP secret key.  If preceded by 0x,
148              then a hex value will be read.
149
150              The  option assumes RFC2406 ESP, not RFC1827 ESP.  The option is
151              only for debugging purposes, and the use of this option  with  a
152              true  `secret'  key  is discouraged.  By presenting IPsec secret
153              key onto command line you make it visible to others,  via  ps(1)
154              and other occasions.
155
156              In  addition  to  the  above syntax, the syntax file name may be
157              used to have tcpdump read the provided  file  in.  The  file  is
158              opened  upon receiving the first ESP packet, so any special per‐
159              missions that tcpdump may have been given  should  already  have
160              been given up.
161
162       -f     Print  `foreign' IPv4 addresses numerically rather than symboli‐
163              cally (this option is intended to get around serious brain  dam‐
164              age  in  Sun's NIS server — usually it hangs forever translating
165              non-local internet numbers).
166
167              The test for `foreign' IPv4 addresses is  done  using  the  IPv4
168              address  and  netmask of the interface on which capture is being
169              done.  If that address or netmask are not available,  available,
170              either  because the interface on which capture is being done has
171              no address or netmask or because the capture is  being  done  on
172              the  Linux  "any"  interface, which can capture on more than one
173              interface, this option will not work correctly.
174
175       -F file
176              Use file as input for  the  filter  expression.   An  additional
177              expression given on the command line is ignored.
178
179       -G rotate_seconds
180              If specified, rotates the dump file specified with the -w option
181              every rotate_seconds seconds.   Savefiles  will  have  the  name
182              specified by -w which should include a time format as defined by
183              strftime(3).  If no time format is specified, each new file will
184              overwrite the previous.
185
186              If  used  in conjunction with the -C option, filenames will take
187              the form of `file<count>'.
188
189       -h
190       --help Print the tcpdump and libpcap version  strings,  print  a  usage
191              message, and exit.
192
193       --version
194              Print the tcpdump and libpcap version strings and exit.
195
196       -H     Attempt to detect 802.11s draft mesh headers.
197
198       -i interface
199       --interface=interface
200              Listen  on interface.  If unspecified, tcpdump searches the sys‐
201              tem interface list for the lowest numbered, configured up inter‐
202              face  (excluding  loopback), which may turn out to be, for exam‐
203              ple, ``eth0''.
204
205              On Linux systems with 2.2 or later kernels, an  interface  argu‐
206              ment  of  ``any'' can be used to capture packets from all inter‐
207              faces.  Note that captures on the ``any''  device  will  not  be
208              done in promiscuous mode.
209
210              If  the  -D flag is supported, an interface number as printed by
211              that flag can be used as the interface argument, if no interface
212              on the system has that number as a name.
213
214       -I
215       --monitor-mode
216              Put  the  interface in "monitor mode"; this is supported only on
217              IEEE 802.11 Wi-Fi interfaces, and supported only on some operat‐
218              ing systems.
219
220              Note  that  in  monitor mode the adapter might disassociate from
221              the network with which it's associated, so that you will not  be
222              able to use any wireless networks with that adapter.  This could
223              prevent accessing files on a network server, or  resolving  host
224              names or network addresses, if you are capturing in monitor mode
225              and are not connected to another network with another adapter.
226
227              This flag will affect the output of the -L flag.   If  -I  isn't
228              specified,  only  those  link-layer  types available when not in
229              monitor mode will be shown; if -I is specified, only those link-
230              layer types available when in monitor mode will be shown.
231
232       --immediate-mode
233              Capture  in  "immediate mode".  In this mode, packets are deliv‐
234              ered to tcpdump as  soon  as  they  arrive,  rather  than  being
235              buffered  for  efficiency.   This  is  the default when printing
236              packets rather than saving packets  to  a  ``savefile''  if  the
237              packets are being printed to a terminal rather than to a file or
238              pipe.
239
240       -j tstamp_type
241       --time-stamp-type=tstamp_type
242              Set the time stamp type for the  capture  to  tstamp_type.   The
243              names   to   use   for   the  time  stamp  types  are  given  in
244              pcap-tstamp(7); not all the types listed there will  necessarily
245              be valid for any given interface.
246
247       -J
248       --list-time-stamp-types
249              List  the supported time stamp types for the interface and exit.
250              If the time stamp type cannot be set for the interface, no  time
251              stamp types are listed.
252
253       --time-stamp-precision=tstamp_precision
254              When  capturing, set the time stamp precision for the capture to
255              tstamp_precision.  Note that availability of high precision time
256              stamps  (nanoseconds)  and their actual accuracy is platform and
257              hardware dependent.  Also note that when writing  captures  made
258              with  nanosecond  accuracy  to  a  savefile, the time stamps are
259              written with nanosecond resolution, and the file is written with
260              a  different  magic number, to indicate that the time stamps are
261              in seconds and nanoseconds; not  all  programs  that  read  pcap
262              savefiles will be able to read those captures.
263
264       When reading a savefile, convert time stamps to the precision specified
265       by timestamp_precision, and display them with that resolution.  If  the
266       precision  specified  is  less than the precision of time stamps in the
267       file, the conversion will lose precision.
268
269       The supported values for timestamp_precision are micro for  microsecond
270       resolution   and  nano  for  nanosecond  resolution.   The  default  is
271       microsecond resolution.
272
273       -K
274       --dont-verify-checksums
275              Don't attempt to verify IP, TCP, or UDP checksums.  This is use‐
276              ful  for  interfaces  that perform some or all of those checksum
277              calculation in hardware; otherwise, all outgoing  TCP  checksums
278              will be flagged as bad.
279
280       -l     Make  stdout  line buffered.  Useful if you want to see the data
281              while capturing it.  E.g.,
282
283                     tcpdump -l | tee dat
284
285              or
286
287                     tcpdump -l > dat & tail -f dat
288
289              Note that on Windows,``line buffered'' means ``unbuffered'',  so
290              that  WinDump  will  write  each character individually if -l is
291              specified.
292
293              -U is similar to -l in its behavior, but it will cause output to
294              be  ``packet-buffered'', so that the output is written to stdout
295              at the end of each packet rather than at the end of  each  line;
296              this is buffered on all platforms, including Windows.
297
298       -L
299       --list-data-link-types
300              List  the known data link types for the interface, in the speci‐
301              fied mode, and exit.  The list of known data link types  may  be
302              dependent on the specified mode; for example, on some platforms,
303              a Wi-Fi interface might support one set of data link types  when
304              not  in  monitor  mode  (for example, it might support only fake
305              Ethernet headers, or might support 802.11 headers but  not  sup‐
306              port  802.11  headers with radio information) and another set of
307              data link types when in monitor mode (for example, it might sup‐
308              port  802.11  headers, or 802.11 headers with radio information,
309              only in monitor mode).
310
311       -m module
312              Load SMI MIB module definitions from file module.   This  option
313              can  be used several times to load several MIB modules into tcp‐
314              dump.
315
316       -M secret
317              Use secret as a shared secret for validating the  digests  found
318              in TCP segments with the TCP-MD5 option (RFC 2385), if present.
319
320       -n     Don't  convert  host  addresses  to  names.  This can be used to
321              avoid DNS lookups.
322
323       -nn    Don't convert protocol and port numbers etc. to names either.
324
325       -N     Don't print domain name qualification of host names.   E.g.,  if
326              you  give  this  flag then tcpdump will print ``nic'' instead of
327              ``nic.ddn.mil''.
328
329       -#
330       --number
331              Print an optional packet number at the beginning of the line.
332
333       -O
334       --no-optimize
335              Do not run the packet-matching code optimizer.  This  is  useful
336              only if you suspect a bug in the optimizer.
337
338       -p
339       --no-promiscuous-mode
340              Don't  put  the  interface into promiscuous mode.  Note that the
341              interface might be in promiscuous mode for  some  other  reason;
342              hence,  `-p'  cannot  be used as an abbreviation for `ether host
343              {local-hw-addr} or ether broadcast'.
344
345       -Q direction
346       --direction=direction
347              Choose send/receive direction direction for which packets should
348              be  captured.  Possible  values are `in', `out' and `inout'. Not
349              available on all platforms.
350
351       -q     Quick (quiet?) output.  Print less protocol information so  out‐
352              put lines are shorter.
353
354       -r file
355              Read  packets from file (which was created with the -w option or
356              by other tools that write  pcap  or  pcap-ng  files).   Standard
357              input is used if file is ``-''.
358
359       -S
360       --absolute-tcp-sequence-numbers
361              Print absolute, rather than relative, TCP sequence numbers.
362
363       -s snaplen
364       --snapshot-length=snaplen
365              Snarf  snaplen  bytes  of  data from each packet rather than the
366              default of 262144 bytes.  Packets truncated because of a limited
367              snapshot  are  indicated  in the output with ``[|proto]'', where
368              proto is the name of the protocol level at which the  truncation
369              has  occurred.  Note that taking larger snapshots both increases
370              the amount of time it takes to process packets and, effectively,
371              decreases  the amount of packet buffering.  This may cause pack‐
372              ets to be lost.  You should limit snaplen to the smallest number
373              that will capture the protocol information you're interested in.
374              Setting snaplen to 0 sets it to the default of 262144, for back‐
375              wards compatibility with recent older versions of tcpdump.
376
377       -T type
378              Force  packets  selected  by  "expression" to be interpreted the
379              specified type.  Currently known  types  are  aodv  (Ad-hoc  On-
380              demand  Distance  Vector  protocol), carp (Common Address Redun‐
381              dancy Protocol), cnfp (Cisco NetFlow protocol), lmp  (Link  Man‐
382              agement  Protocol), pgm (Pragmatic General Multicast), pgm_zmtp1
383              (ZMTP/1.0 inside PGM/EPGM), resp (REdis Serialization Protocol),
384              radius  (RADIUS),  rpc  (Remote  Procedure Call), rtp (Real-Time
385              Applications protocol),  rtcp  (Real-Time  Applications  control
386              protocol),  snmp  (Simple  Network  Management  Protocol),  tftp
387              (Trivial File Transfer Protocol), vat (Visual  Audio  Tool),  wb
388              (distributed  White Board), zmtp1 (ZeroMQ Message Transport Pro‐
389              tocol 1.0) and vxlan (Virtual eXtensible Local Area Network).
390
391              Note that the pgm type above affects  UDP  interpretation  only,
392              the  native  PGM is always recognised as IP protocol 113 regard‐
393              less. UDP-encapsulated PGM is often called "EPGM" or "PGM/UDP".
394
395              Note that the pgm_zmtp1 type  above  affects  interpretation  of
396              both  native PGM and UDP at once. During the native PGM decoding
397              the application data of an ODATA/RDATA packet would  be  decoded
398              as  a  ZeroMQ  datagram  with  ZMTP/1.0  frames.  During the UDP
399              decoding in addition to that any UDP packet would be treated  as
400              an encapsulated PGM packet.
401
402       -t     Don't print a timestamp on each dump line.
403
404       -tt    Print the timestamp, as seconds since January 1, 1970, 00:00:00,
405              UTC, and fractions of a second since that  time,  on  each  dump
406              line.
407
408       -ttt   Print a delta (micro-second resolution) between current and pre‐
409              vious line on each dump line.
410
411       -tttt  Print a timestamp, as hours, minutes, seconds, and fractions  of
412              a  second  since  midnight,  preceded  by the date, on each dump
413              line.
414
415       -ttttt Print a delta  (micro-second  resolution)  between  current  and
416              first line on each dump line.
417
418       -u     Print undecoded NFS handles.
419
420       -U
421       --packet-buffered
422              If  the -w option is not specified, make the printed packet out‐
423              put ``packet-buffered''; i.e., as the description  of  the  con‐
424              tents of each packet is printed, it will be written to the stan‐
425              dard output, rather than, when not writing to a terminal,  being
426              written only when the output buffer fills.
427
428              If  the -w option is specified, make the saved raw packet output
429              ``packet-buffered''; i.e., as each packet is saved, it  will  be
430              written  to the output file, rather than being written only when
431              the output buffer fills.
432
433              The -U flag will not be supported if tcpdump was built  with  an
434              older  version of libpcap that lacks the pcap_dump_flush() func‐
435              tion.
436
437       -v     When parsing and printing, produce (slightly more) verbose  out‐
438              put.   For  example,  the  time  to  live, identification, total
439              length and options in an IP packet are  printed.   Also  enables
440              additional  packet integrity checks such as verifying the IP and
441              ICMP header checksum.
442
443              When writing to a file with the -w option, report, every 10 sec‐
444              onds, the number of packets captured.
445
446       -vv    Even  more  verbose  output.  For example, additional fields are
447              printed from NFS  reply  packets,  and  SMB  packets  are  fully
448              decoded.
449
450       -vvv   Even more verbose output.  For example, telnet SB ... SE options
451              are printed in full.  With -X Telnet options are printed in  hex
452              as well.
453
454       -V file
455              Read  a  list  of filenames from file. Standard input is used if
456              file is ``-''.
457
458       -w file
459              Write the raw packets to file rather than parsing  and  printing
460              them  out.  They can later be printed with the -r option.  Stan‐
461              dard output is used if file is ``-''.
462
463              This output will be buffered if written to a file or pipe, so  a
464              program reading from the file or pipe may not see packets for an
465              arbitrary amount of time after they are received.   Use  the  -U
466              flag  to  cause  packets  to  be  written  as  soon  as they are
467              received.
468
469              The MIME type application/vnd.tcpdump.pcap has  been  registered
470              with  IANA  for pcap files. The filename extension .pcap appears
471              to be the most commonly used along with .cap and  .dmp.  Tcpdump
472              itself  doesn't  check  the extension when reading capture files
473              and doesn't add an extension when writing them  (it  uses  magic
474              numbers  in  the  file  header instead). However, many operating
475              systems and applications will use the extension if it is present
476              and adding one (e.g. .pcap) is recommended.
477
478              See pcap-savefile(5) for a description of the file format.
479
480       -W     Used in conjunction with the -C option, this will limit the num‐
481              ber of files created to the specified number,  and  begin  over‐
482              writing  files  from  the  beginning, thus creating a 'rotating'
483              buffer.  In addition, it will name the files with enough leading
484              0s to support the maximum number of files, allowing them to sort
485              correctly.
486
487              Used in conjunction with the -G option, this will limit the num‐
488              ber  of rotated dump files that get created, exiting with status
489              0 when reaching the limit. If used with -C as well, the behavior
490              will result in cyclical files per timeslice.
491
492       -x     When  parsing  and printing, in addition to printing the headers
493              of each packet, print the data of each packet  (minus  its  link
494              level  header)  in  hex.   The  smaller  of the entire packet or
495              snaplen bytes will be printed.  Note that  this  is  the  entire
496              link-layer  packet, so for link layers that pad (e.g. Ethernet),
497              the padding bytes will also be printed  when  the  higher  layer
498              packet is shorter than the required padding.
499
500       -xx    When  parsing  and printing, in addition to printing the headers
501              of each packet, print the data of  each  packet,  including  its
502              link level header, in hex.
503
504       -X     When  parsing  and printing, in addition to printing the headers
505              of each packet, print the data of each packet  (minus  its  link
506              level  header)  in  hex  and  ASCII.   This  is  very  handy for
507              analysing new protocols.
508
509       -XX    When parsing and printing, in addition to printing  the  headers
510              of  each  packet,  print  the data of each packet, including its
511              link level header, in hex and ASCII.
512
513       -y datalinktype
514       --linktype=datalinktype
515              Set the data  link  type  to  use  while  capturing  packets  to
516              datalinktype.
517
518       -z postrotate-command
519              Used  in  conjunction  with the -C or -G options, this will make
520              tcpdump run " postrotate-command file " where file is the  save‐
521              file  being  closed after each rotation. For example, specifying
522              -z gzip or -z bzip2 will compress each savefile  using  gzip  or
523              bzip2.
524
525              Note  that  tcpdump will run the command in parallel to the cap‐
526              ture, using the lowest priority so that this doesn't disturb the
527              capture process.
528
529              And  in  case  you would like to use a command that itself takes
530              flags or different arguments,  you  can  always  write  a  shell
531              script  that  will  take the savefile name as the only argument,
532              make the flags & arguments arrangements and execute the  command
533              that you want.
534
535       -Z user
536       --relinquish-privileges=user
537              If  tcpdump is running as root, after opening the capture device
538              or input savefile, but before opening any savefiles for  output,
539              change the user ID to user and the group ID to the primary group
540              of user.
541
542              This behavior is enabled by default (-Z  tcpdump),  and  can  be
543              disabled by -Z root.
544
545
546        expression
547              selects  which  packets  will  be  dumped.   If no expression is
548              given, all packets on the net will be dumped.   Otherwise,  only
549              packets for which expression is `true' will be dumped.
550
551              For the expression syntax, see pcap-filter(7).
552
553              The  expression  argument  can  be passed to tcpdump as either a
554              single Shell argument, or as multiple Shell arguments, whichever
555              is more convenient.  Generally, if the expression contains Shell
556              metacharacters, such as  backslashes  used  to  escape  protocol
557              names,  it  is  easier  to  pass it as a single, quoted argument
558              rather than to escape the Shell metacharacters.  Multiple  argu‐
559              ments are concatenated with spaces before being parsed.
560

EXAMPLES

562       To print all packets arriving at or departing from sundown:
563              tcpdump host sundown
564
565       To print traffic between helios and either hot or ace:
566              tcpdump host helios and \( hot or ace \)
567
568       To print all IP packets between ace and any host except helios:
569              tcpdump ip host ace and not helios
570
571       To print all traffic between local hosts and hosts at Berkeley:
572              tcpdump net ucb-ether
573
574       To  print all ftp traffic through internet gateway snup: (note that the
575       expression is quoted to prevent the shell from  (mis-)interpreting  the
576       parentheses):
577              tcpdump 'gateway snup and (port ftp or ftp-data)'
578
579       To  print traffic neither sourced from nor destined for local hosts (if
580       you gateway to one other net, this stuff should never make it onto your
581       local net).
582              tcpdump ip and not net localnet
583
584       To  print  the  start and end packets (the SYN and FIN packets) of each
585       TCP conversation that involves a non-local host.
586              tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net localnet'
587
588       To print all IPv4 HTTP packets to and from port  80,  i.e.  print  only
589       packets  that  contain  data, not, for example, SYN and FIN packets and
590       ACK-only packets.  (IPv6 is left as an exercise for the reader.)
591              tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
592
593       To print IP packets longer than 576 bytes sent through gateway snup:
594              tcpdump 'gateway snup and ip[2:2] > 576'
595
596       To print IP broadcast or multicast packets that were not sent via  Eth‐
597       ernet broadcast or multicast:
598              tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'
599
600       To print all ICMP packets that are not echo requests/replies (i.e., not
601       ping packets):
602              tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'
603

OUTPUT FORMAT

605       The output of tcpdump is protocol dependent.   The  following  gives  a
606       brief description and examples of most of the formats.
607
608       Timestamps
609
610       By  default,  all  output lines are preceded by a timestamp.  The time‐
611       stamp is the current clock time in the form
612              hh:mm:ss.frac
613       and is as accurate as the kernel's clock.  The timestamp  reflects  the
614       time the kernel applied a time stamp to the packet.  No attempt is made
615       to account for the time lag between when the network interface finished
616       receiving  the  packet  from  the network and when the kernel applied a
617       time stamp to the packet; that time lag could include a  delay  between
618       the  time  when  the network interface finished receiving a packet from
619       the network and the time when an interrupt was delivered to the  kernel
620       to get it to read the packet and a delay between the time when the ker‐
621       nel serviced the `new packet' interrupt and the time when it applied  a
622       time stamp to the packet.
623
624       Link Level Headers
625
626       If  the '-e' option is given, the link level header is printed out.  On
627       Ethernets, the source and destination addresses, protocol,  and  packet
628       length are printed.
629
630       On  FDDI  networks, the  '-e' option causes tcpdump to print the `frame
631       control' field,  the source and destination addresses, and  the  packet
632       length.   (The  `frame control' field governs the interpretation of the
633       rest of the packet.  Normal packets (such as those containing IP  data‐
634       grams)  are `async' packets, with a priority value between 0 and 7; for
635       example, `async4'.  Such packets are assumed to contain an 802.2  Logi‐
636       cal  Link  Control (LLC) packet; the LLC header is printed if it is not
637       an ISO datagram or a so-called SNAP packet.
638
639       On Token Ring networks, the '-e' option causes  tcpdump  to  print  the
640       `access control' and `frame control' fields, the source and destination
641       addresses, and the packet length.  As on  FDDI  networks,  packets  are
642       assumed  to  contain  an  LLC  packet.   Regardless of whether the '-e'
643       option is specified or not, the source routing information  is  printed
644       for source-routed packets.
645
646       On  802.11 networks, the '-e' option causes tcpdump to print the `frame
647       control' fields, all of the addresses in the  802.11  header,  and  the
648       packet  length.  As on FDDI networks, packets are assumed to contain an
649       LLC packet.
650
651       (N.B.: The following description assumes familiarity with the SLIP com‐
652       pression algorithm described in RFC-1144.)
653
654       On SLIP links, a direction indicator (``I'' for inbound, ``O'' for out‐
655       bound), packet type, and compression information are printed out.   The
656       packet  type is printed first.  The three types are ip, utcp, and ctcp.
657       No further link information is printed for ip packets.  For  TCP  pack‐
658       ets,  the  connection identifier is printed following the type.  If the
659       packet is compressed, its encoded header is printed out.   The  special
660       cases are printed out as *S+n and *SA+n, where n is the amount by which
661       the sequence number (or sequence number and ack) has changed.  If it is
662       not  a  special  case,  zero  or more changes are printed.  A change is
663       indicated by U (urgent pointer), W (window), A (ack), S (sequence  num‐
664       ber), and I (packet ID), followed by a delta (+n or -n), or a new value
665       (=n).  Finally, the amount of data in the packet and compressed  header
666       length are printed.
667
668       For  example,  the  following  line  shows  an  outbound compressed TCP
669       packet, with an implicit connection identifier; the ack has changed  by
670       6, the sequence number by 49, and the packet ID by 6; there are 3 bytes
671       of data and 6 bytes of compressed header:
672              O ctcp * A+6 S+49 I+6 3 (6)
673
674       ARP/RARP Packets
675
676       Arp/rarp output shows the type of request and its arguments.  The  for‐
677       mat  is  intended to be self explanatory.  Here is a short sample taken
678       from the start of an `rlogin' from host rtsg to host csam:
679              arp who-has csam tell rtsg
680              arp reply csam is-at CSAM
681       The first line says that rtsg sent an arp packet asking for the  Ether‐
682       net  address  of  internet  host  csam.  Csam replies with its Ethernet
683       address (in this example, Ethernet addresses are in caps  and  internet
684       addresses in lower case).
685
686       This would look less redundant if we had done tcpdump -n:
687              arp who-has 128.3.254.6 tell 128.3.254.68
688              arp reply 128.3.254.6 is-at 02:07:01:00:01:c4
689
690       If  we had done tcpdump -e, the fact that the first packet is broadcast
691       and the second is point-to-point would be visible:
692              RTSG Broadcast 0806  64: arp who-has csam tell rtsg
693              CSAM RTSG 0806  64: arp reply csam is-at CSAM
694       For the first packet this says the Ethernet source address is RTSG, the
695       destination is the Ethernet broadcast address, the type field contained
696       hex 0806 (type ETHER_ARP) and the total length was 64 bytes.
697
698       IPv4 Packets
699
700       If the link-layer header is not being printed, for IPv4 packets, IP  is
701       printed after the time stamp.
702
703       If  the -v flag is specified, information from the IPv4 header is shown
704       in parentheses after the IP or the link-layer header.  The general for‐
705       mat of this information is:
706              tos tos, ttl ttl, id id, offset offset, flags [flags], proto proto, length length, options (options)
707       tos  is  the type of service field; if the ECN bits are non-zero, those
708       are reported as ECT(1), ECT(0), or CE.  ttl is the time-to-live; it  is
709       not reported if it is zero.  id is the IP identification field.  offset
710       is the fragment offset field; it is printed whether this is part  of  a
711       fragmented  datagram  or  not.   flags  are  the  MF and DF flags; + is
712       reported if MF is set, and DFP is reported if F is set.  If neither are
713       set,  .  is  reported.   proto is the protocol ID field.  length is the
714       total length field.  options are the IP options, if any.
715
716       Next, for TCP and UDP packets, the source and destination IP  addresses
717       and TCP or UDP ports, with a dot between each IP address and its corre‐
718       sponding port, will be printed, with a > separating the source and des‐
719       tination.  For other protocols, the addresses will be printed, with a >
720       separating the source and destination.  Higher level protocol  informa‐
721       tion, if any, will be printed after that.
722
723       For  fragmented  IP  datagrams,  the first fragment contains the higher
724       level protocol header; fragments after  the  first  contain  no  higher
725       level  protocol header.  Fragmentation information will be printed only
726       with the -v flag, in the IP header information, as described above.
727
728       TCP Packets
729
730       (N.B.:The following description assumes familiarity with the TCP proto‐
731       col  described  in RFC-793.  If you are not familiar with the protocol,
732       this description will not be of much use to you.)
733
734       The general format of a TCP protocol line is:
735              src > dst: Flags [tcpflags], seq data-seqno, ack ackno, win window, urg urgent, options [opts], length len
736       Src and dst are the source and  destination  IP  addresses  and  ports.
737       Tcpflags are some combination of S (SYN), F (FIN), P (PUSH), R (RST), U
738       (URG), W (ECN CWR), E (ECN-Echo) or `.' (ACK), or `none'  if  no  flags
739       are set.  Data-seqno describes the portion of sequence space covered by
740       the data in this packet (see example below).  Ackno is sequence  number
741       of the next data expected the other direction on this connection.  Win‐
742       dow is the number of bytes of receive buffer space available the  other
743       direction  on this connection.  Urg indicates there is `urgent' data in
744       the packet.  Opts are TCP options (e.g., mss 1024).  Len is the  length
745       of payload data.
746
747       Iptype,  Src,  dst,  and  flags  are  always present.  The other fields
748       depend on the contents of the packet's TCP protocol header and are out‐
749       put only if appropriate.
750
751       Here is the opening portion of an rlogin from host rtsg to host csam.
752              IP rtsg.1023 > csam.login: Flags [S], seq 768512:768512, win 4096, opts [mss 1024]
753              IP csam.login > rtsg.1023: Flags [S.], seq, 947648:947648, ack 768513, win 4096, opts [mss 1024]
754              IP rtsg.1023 > csam.login: Flags [.], ack 1, win 4096
755              IP rtsg.1023 > csam.login: Flags [P.], seq 1:2, ack 1, win 4096, length 1
756              IP csam.login > rtsg.1023: Flags [.], ack 2, win 4096
757              IP rtsg.1023 > csam.login: Flags [P.], seq 2:21, ack 1, win 4096, length 19
758              IP csam.login > rtsg.1023: Flags [P.], seq 1:2, ack 21, win 4077, length 1
759              IP csam.login > rtsg.1023: Flags [P.], seq 2:3, ack 21, win 4077, urg 1, length 1
760              IP csam.login > rtsg.1023: Flags [P.], seq 3:4, ack 21, win 4077, urg 1, length 1
761       The  first  line  says that TCP port 1023 on rtsg sent a packet to port
762       login on csam.  The S indicates that the SYN flag was set.  The  packet
763       sequence  number was 768512 and it contained no data.  (The notation is
764       `first:last' which means `sequence numbers first up to but not  includ‐
765       ing last.)  There was no piggy-backed ack, the available receive window
766       was 4096 bytes and there was a max-segment-size  option  requesting  an
767       mss of 1024 bytes.
768
769       Csam  replies  with  a similar packet except it includes a piggy-backed
770       ack for rtsg's SYN.  Rtsg then acks csam's SYN.  The `.' means the  ACK
771       flag  was  set.   The  packet  contained  no  data  so there is no data
772       sequence number or length.  Note that the  ack  sequence  number  is  a
773       small  integer  (1).  The first time tcpdump sees a TCP `conversation',
774       it prints the sequence number from the packet.  On  subsequent  packets
775       of  the  conversation,  the  difference  between  the  current packet's
776       sequence number and this initial  sequence  number  is  printed.   This
777       means that sequence numbers after the first can be interpreted as rela‐
778       tive byte positions in the conversation's data stream (with  the  first
779       data  byte each direction being `1').  `-S' will override this feature,
780       causing the original sequence numbers to be output.
781
782       On the 6th line, rtsg sends csam 19 bytes of data (bytes 2  through  20
783       in  the rtsg → csam side of the conversation).  The PUSH flag is set in
784       the packet.  On the 7th line, csam says it's received data sent by rtsg
785       up  to but not including byte 21.  Most of this data is apparently sit‐
786       ting in the socket buffer since csam's receive  window  has  gotten  19
787       bytes  smaller.   Csam  also  sends  one  byte  of data to rtsg in this
788       packet.  On the 8th and 9th lines, csam  sends  two  bytes  of  urgent,
789       pushed data to rtsg.
790
791       If  the  snapshot was small enough that tcpdump didn't capture the full
792       TCP header, it interprets as much of the header  as  it  can  and  then
793       reports  ``[|tcp]'' to indicate the remainder could not be interpreted.
794       If the header contains a bogus option (one with a length that's  either
795       too  small  or  beyond  the  end  of the header), tcpdump reports it as
796       ``[bad opt]'' and does not interpret any further  options  (since  it's
797       impossible  to  tell where they start).  If the header length indicates
798       options are present but the IP datagram length is not long  enough  for
799       the  options  to  actually  be  there, tcpdump reports it as ``[bad hdr
800       length]''.
801
802       Capturing TCP packets with particular flag combinations (SYN-ACK,  URG-
803       ACK, etc.)
804
805       There are 8 bits in the control bits section of the TCP header:
806
807              CWR | ECE | URG | ACK | PSH | RST | SYN | FIN
808
809       Let's  assume  that we want to watch packets used in establishing a TCP
810       connection.  Recall that TCP uses a 3-way handshake  protocol  when  it
811       initializes  a  new  connection; the connection sequence with regard to
812       the TCP control bits is
813
814              1) Caller sends SYN
815              2) Recipient responds with SYN, ACK
816              3) Caller sends ACK
817
818       Now we're interested in capturing packets that have only  the  SYN  bit
819       set  (Step  1).  Note that we don't want packets from step 2 (SYN-ACK),
820       just a plain initial SYN.  What we need is a correct filter  expression
821       for tcpdump.
822
823       Recall the structure of a TCP header without options:
824
825        0                            15                              31
826       -----------------------------------------------------------------
827       |          source port          |       destination port        |
828       -----------------------------------------------------------------
829       |                        sequence number                        |
830       -----------------------------------------------------------------
831       |                     acknowledgment number                     |
832       -----------------------------------------------------------------
833       |  HL   | rsvd  |C|E|U|A|P|R|S|F|        window size            |
834       -----------------------------------------------------------------
835       |         TCP checksum          |       urgent pointer          |
836       -----------------------------------------------------------------
837
838       A  TCP  header  usually  holds  20  octets  of data, unless options are
839       present.  The first line of the graph contains octets 0 - 3, the second
840       line shows octets 4 - 7 etc.
841
842       Starting  to  count with 0, the relevant TCP control bits are contained
843       in octet 13:
844
845        0             7|             15|             23|             31
846       ----------------|---------------|---------------|----------------
847       |  HL   | rsvd  |C|E|U|A|P|R|S|F|        window size            |
848       ----------------|---------------|---------------|----------------
849       |               |  13th octet   |               |               |
850
851       Let's have a closer look at octet no. 13:
852
853                       |               |
854                       |---------------|
855                       |C|E|U|A|P|R|S|F|
856                       |---------------|
857                       |7   5   3     0|
858
859       These are the TCP control bits we are interested in.  We have  numbered
860       the  bits  in  this octet from 0 to 7, right to left, so the PSH bit is
861       bit number 3, while the URG bit is number 5.
862
863       Recall that we want to capture packets with only SYN  set.   Let's  see
864       what happens to octet 13 if a TCP datagram arrives with the SYN bit set
865       in its header:
866
867                       |C|E|U|A|P|R|S|F|
868                       |---------------|
869                       |0 0 0 0 0 0 1 0|
870                       |---------------|
871                       |7 6 5 4 3 2 1 0|
872
873       Looking at the control bits section we see that only bit number 1 (SYN)
874       is set.
875
876       Assuming  that  octet number 13 is an 8-bit unsigned integer in network
877       byte order, the binary value of this octet is
878
879              00000010
880
881       and its decimal representation is
882
883          7     6     5     4     3     2     1     0
884       0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 1*2 + 0*2  =  2
885
886       We're almost done, because now we know that if only  SYN  is  set,  the
887       value  of the 13th octet in the TCP header, when interpreted as a 8-bit
888       unsigned integer in network byte order, must be exactly 2.
889
890       This relationship can be expressed as
891              tcp[13] == 2
892
893       We can use this expression as the filter for tcpdump in order to  watch
894       packets which have only SYN set:
895              tcpdump -i xl0 tcp[13] == 2
896
897       The expression says "let the 13th octet of a TCP datagram have the dec‐
898       imal value 2", which is exactly what we want.
899
900       Now, let's assume that we need to capture SYN  packets,  but  we  don't
901       care  if  ACK  or  any  other  TCP control bit is set at the same time.
902       Let's see what happens to octet 13 when a TCP datagram with SYN-ACK set
903       arrives:
904
905            |C|E|U|A|P|R|S|F|
906            |---------------|
907            |0 0 0 1 0 0 1 0|
908            |---------------|
909            |7 6 5 4 3 2 1 0|
910
911       Now  bits 1 and 4 are set in the 13th octet.  The binary value of octet
912       13 is
913
914                   00010010
915
916       which translates to decimal
917
918          7     6     5     4     3     2     1     0
919       0*2 + 0*2 + 0*2 + 1*2 + 0*2 + 0*2 + 1*2 + 0*2   = 18
920
921       Now we can't just use 'tcp[13] == 18' in the tcpdump filter expression,
922       because that would select only those packets that have SYN-ACK set, but
923       not those with only SYN set.  Remember that we don't care if ACK or any
924       other control bit is set as long as SYN is set.
925
926       In order to achieve our goal, we need to logically AND the binary value
927       of octet 13 with some other value to preserve the  SYN  bit.   We  know
928       that  we  want  SYN  to  be set in any case, so we'll logically AND the
929       value in the 13th octet with the binary value of a SYN:
930
931                 00010010 SYN-ACK              00000010 SYN
932            AND  00000010 (we want SYN)   AND  00000010 (we want SYN)
933                 --------                      --------
934            =    00000010                 =    00000010
935
936       We see that this AND operation  delivers  the  same  result  regardless
937       whether ACK or another TCP control bit is set.  The decimal representa‐
938       tion of the AND value as well as the result  of  this  operation  is  2
939       (binary 00000010), so we know that for packets with SYN set the follow‐
940       ing relation must hold true:
941
942              ( ( value of octet 13 ) AND ( 2 ) ) == ( 2 )
943
944       This points us to the tcpdump filter expression
945                   tcpdump -i xl0 'tcp[13] & 2 == 2'
946
947       Some offsets and field values may be expressed as names rather than  as
948       numeric values. For example tcp[13] may be replaced with tcp[tcpflags].
949       The following TCP flag field values are also available:  tcp-fin,  tcp-
950       syn, tcp-rst, tcp-push, tcp-act, tcp-urg.
951
952       This can be demonstrated as:
953                   tcpdump -i xl0 'tcp[tcpflags] & tcp-push != 0'
954
955       Note that you should use single quotes or a backslash in the expression
956       to hide the AND ('&') special character from the shell.
957
958       UDP Packets
959
960       UDP format is illustrated by this rwho packet:
961              actinide.who > broadcast.who: udp 84
962       This says that port who on host actinide sent a udp  datagram  to  port
963       who on host broadcast, the Internet broadcast address.  The packet con‐
964       tained 84 bytes of user data.
965
966       Some UDP services are recognized (from the source or  destination  port
967       number) and the higher level protocol information printed.  In particu‐
968       lar, Domain Name service requests (RFC-1034/1035)  and  Sun  RPC  calls
969       (RFC-1050) to NFS.
970
971       UDP Name Server Requests
972
973       (N.B.:The  following  description  assumes  familiarity with the Domain
974       Service protocol described in RFC-1035.  If you are not  familiar  with
975       the  protocol,  the  following description will appear to be written in
976       greek.)
977
978       Name server requests are formatted as
979              src > dst: id op? flags qtype qclass name (len)
980              h2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)
981       Host h2opolo asked the domain server on helios for  an  address  record
982       (qtype=A)  associated  with the name ucbvax.berkeley.edu.  The query id
983       was `3'.  The `+' indicates the recursion desired flag  was  set.   The
984       query  length was 37 bytes, not including the UDP and IP protocol head‐
985       ers.  The query operation was the normal one, Query, so  the  op  field
986       was  omitted.   If  the  op  had been anything else, it would have been
987       printed between the `3' and the `+'.  Similarly,  the  qclass  was  the
988       normal  one,  C_IN,  and  omitted.   Any  other  qclass would have been
989       printed immediately after the `A'.
990
991       A few anomalies are checked and may result in extra fields enclosed  in
992       square  brackets:   If a query contains an answer, authority records or
993       additional records section, ancount, nscount, or arcount are printed as
994       `[na]', `[nn]' or  `[nau]' where n is the appropriate count.  If any of
995       the response bits are set (AA, RA or rcode) or  any  of  the  `must  be
996       zero' bits are set in bytes two and three, `[b2&3=x]' is printed, where
997       x is the hex value of header bytes two and three.
998
999       UDP Name Server Responses
1000
1001       Name server responses are formatted as
1002              src > dst:  id op rcode flags a/n/au type class data (len)
1003              helios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)
1004              helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)
1005       In the first example, helios responds to query id 3 from h2opolo with 3
1006       answer  records,  3  name server records and 7 additional records.  The
1007       first answer record is type  A  (address)  and  its  data  is  internet
1008       address  128.32.137.3.   The  total size of the response was 273 bytes,
1009       excluding UDP and IP headers.  The op (Query) and response code  (NoEr‐
1010       ror) were omitted, as was the class (C_IN) of the A record.
1011
1012       In  the second example, helios responds to query 2 with a response code
1013       of non-existent domain (NXDomain) with no answers, one name server  and
1014       no  authority records.  The `*' indicates that the authoritative answer
1015       bit was set.  Since there were no answers, no type, class or data  were
1016       printed.
1017
1018       Other  flag  characters that might appear are `-' (recursion available,
1019       RA, not set) and `|' (truncated message, TC, set).  If  the  `question'
1020       section doesn't contain exactly one entry, `[nq]' is printed.
1021
1022       SMB/CIFS decoding
1023
1024       tcpdump now includes fairly extensive SMB/CIFS/NBT decoding for data on
1025       UDP/137, UDP/138 and TCP/139.  Some primitive decoding of IPX and  Net‐
1026       BEUI SMB data is also done.
1027
1028       By  default  a fairly minimal decode is done, with a much more detailed
1029       decode done if -v is used.  Be warned that with -v a single SMB  packet
1030       may  take  up a page or more, so only use -v if you really want all the
1031       gory details.
1032
1033       For information on SMB packet formats and what all the fields mean  see
1034       www.cifs.org   or  the  pub/samba/specs/  directory  on  your  favorite
1035       samba.org mirror site.  The SMB patches were written by Andrew Tridgell
1036       (tridge@samba.org).
1037
1038       NFS Requests and Replies
1039
1040       Sun NFS (Network File System) requests and replies are printed as:
1041              src.sport > dst.nfs: NFS request xid xid len op args
1042              src.nfs > dst.dport: NFS reply xid xid reply stat len op results
1043              sushi.1023 > wrl.nfs: NFS request xid 26377
1044                   112 readlink fh 21,24/10.73165
1045              wrl.nfs > sushi.1023: NFS reply xid 26377
1046                   reply ok 40 readlink "../var"
1047              sushi.1022 > wrl.nfs: NFS request xid 8219
1048                   144 lookup fh 9,74/4096.6878 "xcolors"
1049              wrl.nfs > sushi.1022: NFS reply xid 8219
1050                   reply ok 128 lookup fh 9,74/4134.3150
1051       In the first line, host sushi sends a transaction with id 26377 to wrl.
1052       The request was 112 bytes, excluding the UDP and IP headers.  The oper‐
1053       ation  was  a  readlink  (read  symbolic  link)  on  file  handle  (fh)
1054       21,24/10.731657119.  (If one is lucky, as in this case, the file handle
1055       can be interpreted as a major,minor device number pair, followed by the
1056       inode number and generation number.) In the second  line,  wrl  replies
1057       `ok' with the same transaction id and the contents of the link.
1058
1059       In  the  third  line,  sushi  asks  (using a new transaction id) wrl to
1060       lookup the name `xcolors' in  directory  file  9,74/4096.6878.  In  the
1061       fourth line, wrl sends a reply with the respective transaction id.
1062
1063       Note  that  the data printed depends on the operation type.  The format
1064       is intended to be self explanatory if read in conjunction with  an  NFS
1065       protocol  spec.   Also  note that older versions of tcpdump printed NFS
1066       packets in a slightly different format: the transaction id (xid)  would
1067       be printed instead of the non-NFS port number of the packet.
1068
1069       If  the  -v (verbose) flag is given, additional information is printed.
1070       For example:
1071              sushi.1023 > wrl.nfs: NFS request xid 79658
1072                   148 read fh 21,11/12.195 8192 bytes @ 24576
1073              wrl.nfs > sushi.1023: NFS reply xid 79658
1074                   reply ok 1472 read REG 100664 ids 417/0 sz 29388
1075       (-v also prints the  IP  header  TTL,  ID,  length,  and  fragmentation
1076       fields, which have been omitted from this example.)  In the first line,
1077       sushi asks wrl to read 8192 bytes from file 21,11/12.195, at byte  off‐
1078       set  24576.   Wrl  replies `ok'; the packet shown on the second line is
1079       the first fragment of the reply, and hence is only 1472 bytes long (the
1080       other bytes will follow in subsequent fragments, but these fragments do
1081       not have NFS or even UDP headers and so might not be printed, depending
1082       on  the filter expression used).  Because the -v flag is given, some of
1083       the file attributes (which are returned in addition to the  file  data)
1084       are  printed:  the file type (``REG'', for regular file), the file mode
1085       (in octal), the uid and gid, and the file size.
1086
1087       If the -v flag is given more than once, even more details are printed.
1088
1089       Note that NFS requests are very large and much of the detail  won't  be
1090       printed  unless  snaplen is increased.  Try using `-s 192' to watch NFS
1091       traffic.
1092
1093       NFS reply  packets  do  not  explicitly  identify  the  RPC  operation.
1094       Instead,  tcpdump  keeps track of ``recent'' requests, and matches them
1095       to the replies using the transaction ID.  If a reply does  not  closely
1096       follow the corresponding request, it might not be parsable.
1097
1098       AFS Requests and Replies
1099
1100       Transarc AFS (Andrew File System) requests and replies are printed as:
1101
1102              src.sport > dst.dport: rx packet-type
1103              src.sport > dst.dport: rx packet-type service call call-name args
1104              src.sport > dst.dport: rx packet-type service reply call-name args
1105              elvis.7001 > pike.afsfs:
1106                   rx data fs call rename old fid 536876964/1/1 ".newsrc.new"
1107                   new fid 536876964/1/1 ".newsrc"
1108              pike.afsfs > elvis.7001: rx data fs reply rename
1109       In the first line, host elvis sends a RX packet to pike.  This was a RX
1110       data packet to the fs (fileserver) service, and is the start of an  RPC
1111       call.   The  RPC  call  was a rename, with the old directory file id of
1112       536876964/1/1 and an old filename of `.newsrc.new', and a new directory
1113       file  id  of  536876964/1/1  and a new filename of `.newsrc'.  The host
1114       pike responds with a RPC reply to the rename call (which  was  success‐
1115       ful, because it was a data packet and not an abort packet).
1116
1117       In  general,  all AFS RPCs are decoded at least by RPC call name.  Most
1118       AFS RPCs have at least some of the arguments  decoded  (generally  only
1119       the `interesting' arguments, for some definition of interesting).
1120
1121       The  format is intended to be self-describing, but it will probably not
1122       be useful to people who are not familiar with the workings of  AFS  and
1123       RX.
1124
1125       If  the  -v  (verbose) flag is given twice, acknowledgement packets and
1126       additional header information is printed, such as the RX call ID,  call
1127       number, sequence number, serial number, and the RX packet flags.
1128
1129       If  the -v flag is given twice, additional information is printed, such
1130       as the RX call ID, serial number, and the RX  packet  flags.   The  MTU
1131       negotiation information is also printed from RX ack packets.
1132
1133       If  the -v flag is given three times, the security index and service id
1134       are printed.
1135
1136       Error codes are printed for abort packets, with the exception  of  Ubik
1137       beacon  packets  (because  abort packets are used to signify a yes vote
1138       for the Ubik protocol).
1139
1140       Note that AFS requests are very large and many of the  arguments  won't
1141       be  printed  unless  snaplen is increased.  Try using `-s 256' to watch
1142       AFS traffic.
1143
1144       AFS reply  packets  do  not  explicitly  identify  the  RPC  operation.
1145       Instead,  tcpdump  keeps track of ``recent'' requests, and matches them
1146       to the replies using the call number and service ID.  If a  reply  does
1147       not closely follow the corresponding request, it might not be parsable.
1148
1149
1150       KIP AppleTalk (DDP in UDP)
1151
1152       AppleTalk DDP packets encapsulated in UDP datagrams are de-encapsulated
1153       and dumped as DDP packets (i.e., all the UDP header information is dis‐
1154       carded).   The file /etc/atalk.names is used to translate AppleTalk net
1155       and node numbers to names.  Lines in this file have the form
1156              number    name
1157
1158              1.254          ether
1159              16.1      icsd-net
1160              1.254.110 ace
1161       The first two lines give the names of AppleTalk  networks.   The  third
1162       line  gives the name of a particular host (a host is distinguished from
1163       a net by the 3rd octet in the number -  a  net  number  must  have  two
1164       octets  and a host number must have three octets.)  The number and name
1165       should  be   separated   by   whitespace   (blanks   or   tabs).    The
1166       /etc/atalk.names  file  may contain blank lines or comment lines (lines
1167       starting with a `#').
1168
1169       AppleTalk addresses are printed in the form
1170              net.host.port
1171
1172              144.1.209.2 > icsd-net.112.220
1173              office.2 > icsd-net.112.220
1174              jssmag.149.235 > icsd-net.2
1175       (If the /etc/atalk.names doesn't exist or doesn't contain an entry  for
1176       some AppleTalk host/net number, addresses are printed in numeric form.)
1177       In the first example, NBP (DDP port 2) on net 144.1 node 209 is sending
1178       to  whatever is listening on port 220 of net icsd node 112.  The second
1179       line is the same except the full name  of  the  source  node  is  known
1180       (`office').   The third line is a send from port 235 on net jssmag node
1181       149 to broadcast on the icsd-net NBP  port  (note  that  the  broadcast
1182       address (255) is indicated by a net name with no host number - for this
1183       reason it's a good idea to keep node names and net  names  distinct  in
1184       /etc/atalk.names).
1185
1186       NBP  (name  binding  protocol) and ATP (AppleTalk transaction protocol)
1187       packets have their contents interpreted.  Other protocols just dump the
1188       protocol name (or number if no name is registered for the protocol) and
1189       packet size.
1190
1191       NBP packets are formatted like the following examples:
1192              icsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*"
1193              jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250
1194              techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186
1195       The first line is a name lookup request for laserwriters  sent  by  net
1196       icsd  host  112 and broadcast on net jssmag.  The nbp id for the lookup
1197       is 190.  The second line shows a reply for this request (note  that  it
1198       has  the same id) from host jssmag.209 saying that it has a laserwriter
1199       resource named "RM1140" registered on port  250.   The  third  line  is
1200       another  reply  to the same request saying host techpit has laserwriter
1201       "techpit" registered on port 186.
1202
1203       ATP packet formatting is demonstrated by the following example:
1204              jssmag.209.165 > helios.132: atp-req  12266<0-7> 0xae030001
1205              helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000
1206              helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000
1207              helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000
1208              helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
1209              helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000
1210              helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
1211              helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000
1212              helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000
1213              jssmag.209.165 > helios.132: atp-req  12266<3,5> 0xae030001
1214              helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
1215              helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
1216              jssmag.209.165 > helios.132: atp-rel  12266<0-7> 0xae030001
1217              jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002
1218       Jssmag.209 initiates transaction id 12266 with host helios by  request‐
1219       ing  up  to  8 packets (the `<0-7>').  The hex number at the end of the
1220       line is the value of the `userdata' field in the request.
1221
1222       Helios responds with 8 512-byte packets.  The  `:digit'  following  the
1223       transaction  id gives the packet sequence number in the transaction and
1224       the number in parens is the amount of data in the packet, excluding the
1225       atp header.  The `*' on packet 7 indicates that the EOM bit was set.
1226
1227       Jssmag.209  then  requests that packets 3 & 5 be retransmitted.  Helios
1228       resends them then jssmag.209 releases the transaction.   Finally,  jss‐
1229       mag.209  initiates  the next request.  The `*' on the request indicates
1230       that XO (`exactly once') was not set.
1231
1232

SEE ALSO

1234       stty(1),    pcap(3PCAP),     bpf(4),     nit(4P),     pcap-savefile(5),
1235       pcap-filter(7), pcap-tstamp(7)
1236
1237              http://www.iana.org/assignments/media-types/application/vnd.tcp
1238              dump.pcap
1239

AUTHORS

1241       The original authors are:
1242
1243       Van Jacobson, Craig Leres and  Steven  McCanne,  all  of  the  Lawrence
1244       Berkeley National Laboratory, University of California, Berkeley, CA.
1245
1246       It is currently being maintained by tcpdump.org.
1247
1248       The current version is available via http:
1249
1250              https://www.tcpdump.org/
1251
1252       The original distribution is available via anonymous ftp:
1253
1254              ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z
1255
1256       IPv6/IPsec  support  is  added by WIDE/KAME project.  This program uses
1257       Eric Young's SSLeay library, under specific configurations.
1258

BUGS

1260       To   report   a   security   issue   please   send   an    e-mail    to
1261       security@tcpdump.org.
1262
1263       To  report  bugs and other problems, contribute patches, request a fea‐
1264       ture, provide generic feedback etc please see the file CONTRIBUTING  in
1265       the tcpdump source tree root.
1266
1267       NIT doesn't let you watch your own outbound traffic, BPF will.  We rec‐
1268       ommend that you use the latter.
1269
1270       On Linux systems with 2.0[.x] kernels:
1271
1272              packets on the loopback device will be seen twice;
1273
1274              packet filtering cannot be done in the kernel, so that all pack‐
1275              ets  must  be  copied from the kernel in order to be filtered in
1276              user mode;
1277
1278              all of a packet, not just the part that's  within  the  snapshot
1279              length,  will be copied from the kernel (the 2.0[.x] packet cap‐
1280              ture mechanism, if asked to copy only part of a packet to  user‐
1281              land,  will not report the true length of the packet; this would
1282              cause most IP packets to get an error from tcpdump);
1283
1284              capturing on some PPP devices won't work correctly.
1285
1286       We recommend that you upgrade to a 2.2 or later kernel.
1287
1288       Some attempt should be made to reassemble IP fragments or, at least  to
1289       compute the right length for the higher level protocol.
1290
1291       Name server inverse queries are not dumped correctly: the (empty) ques‐
1292       tion section is printed rather than real query in the  answer  section.
1293       Some  believe  that  inverse queries are themselves a bug and prefer to
1294       fix the program generating them rather than tcpdump.
1295
1296       A packet trace that crosses a daylight savings time  change  will  give
1297       skewed time stamps (the time change is ignored).
1298
1299       Filter  expressions  on  fields  other than those in Token Ring headers
1300       will not correctly handle source-routed Token Ring packets.
1301
1302       Filter expressions on fields other than those in  802.11  headers  will
1303       not  correctly  handle  802.11 data packets with both To DS and From DS
1304       set.
1305
1306       ip6 proto should chase header chain, but at this moment  it  does  not.
1307       ip6 protochain is supplied for this behavior.
1308
1309       Arithmetic  expression  against  transport  layer headers, like tcp[0],
1310       does not work against IPv6 packets.  It only looks at IPv4 packets.
1311
1312
1313
1314                                2 February 2017                     TCPDUMP(8)
Impressum