1 .\" $NetBSD: tcpdump.8,v 1.9 2003/03/31 00:18:17 perry Exp $
3 .\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997
4 .\" The Regents of the University of California. All rights reserved.
5 .\" All rights reserved.
7 .\" Redistribution and use in source and binary forms, with or without
8 .\" modification, are permitted provided that: (1) source code distributions
9 .\" retain the above copyright notice and this paragraph in its entirety, (2)
10 .\" distributions including binary code include the above copyright notice and
11 .\" this paragraph in its entirety in the documentation or other materials
12 .\" provided with the distribution, and (3) all advertising materials mentioning
13 .\" features or use of this software display the following acknowledgement:
14 .\" ``This product includes software developed by the University of California,
15 .\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
16 .\" the University nor the names of its contributors may be used to endorse
17 .\" or promote products derived from this software without specific prior
18 .\" written permission.
19 .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
20 .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
21 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
23 .TH TCPDUMP 1 "17 January 2022"
25 tcpdump \- dump traffic on a network
30 .B \-AbdDefhHIJKlLnNOpqStuUvxX#
51 .I spi@ipaddr algo:secret,...
68 .B \-\-immediate\-mode
91 .B \-\-print\-sampling
134 .I postrotate-command
142 .BI \-\-time\-stamp\-precision= tstamp_precision
159 \fITcpdump\fP prints out a description of the contents of packets on a
160 network interface that match the Boolean \fIexpression\fP; the
161 description is preceded by a time stamp, printed, by default, as hours,
162 minutes, seconds, and fractions of a second since midnight. It can also
165 flag, which causes it to save the packet data to a file for later
166 analysis, and/or with the
168 flag, which causes it to read from a saved packet file rather than to
169 read packets from a network interface. It can also be run with the
171 flag, which causes it to read a list of saved packet files. In all cases,
172 only packets that match
178 will, if not run with the
180 flag, continue capturing packets until it is interrupted by a SIGINT
181 signal (generated, for example, by typing your interrupt character,
182 typically control-C) or a SIGTERM signal (typically generated with the
184 command); if run with the
186 flag, it will capture packets until it is interrupted by a SIGINT or
187 SIGTERM signal or the specified number of packets have been processed.
191 finishes capturing packets, it will report counts of:
193 packets ``captured'' (this is the number of packets that
195 has received and processed);
197 packets ``received by filter'' (the meaning of this depends on the OS on
200 and possibly on the way the OS was configured - if a filter was
201 specified on the command line, on some OSes it counts packets regardless
202 of whether they were matched by the filter expression and, even if they
203 were matched by the filter expression, regardless of whether
205 has read and processed them yet, on other OSes it counts only packets that were
206 matched by the filter expression regardless of whether
208 has read and processed them yet, and on other OSes it counts only
209 packets that were matched by the filter expression and were processed by
212 packets ``dropped by kernel'' (this is the number of packets that were
213 dropped, due to a lack of buffer space, by the packet capture mechanism
216 is running, if the OS reports that information to applications; if not,
217 it will be reported as 0).
219 On platforms that support the SIGINFO signal, such as most BSDs
220 (including macOS) and Digital/Tru64 UNIX, it will report those counts
221 when it receives a SIGINFO signal (generated, for example, by typing
222 your ``status'' character, typically control-T, although on some
223 platforms, such as macOS, the ``status'' character is not set by
224 default, so you must set it with
226 in order to use it) and will continue capturing packets. On platforms that
227 do not support the SIGINFO signal, the same can be achieved by using the
230 Using the SIGUSR2 signal along with the
232 flag will forcibly flush the packet buffer into the output file.
234 Reading packets from a network interface may require that you have
235 special privileges; see the
237 man page for details. Reading a saved packet file doesn't require
242 Print each packet (minus its link level header) in ASCII. Handy for
246 Print the AS number in BGP packets in ASDOT notation rather than ASPLAIN
249 .BI \-B " buffer_size"
252 .BI \-\-buffer\-size= buffer_size
254 Set the operating system capture buffer size to \fIbuffer_size\fP, in
255 units of KiB (1024 bytes).
258 Exit after receiving \fIcount\fP packets.
261 Print only on stdout the packet count when reading capture file(s) instead
262 of parsing/printing the packets. If a filter is specified on the command
263 line, \fItcpdump\fP counts only packets that were matched by the filter
267 Before writing a raw packet to a savefile, check whether the file is
268 currently larger than \fIfile_size\fP and, if so, close the current
269 savefile and open a new one. Savefiles after the first savefile will
270 have the name specified with the
272 flag, with a number after it, starting at 1 and continuing upward.
273 The default unit of \fIfile_size\fP is millions of bytes (1,000,000 bytes,
274 not 1,048,576 bytes).
276 By adding a suffix of k/K, m/M or g/G to the value, the unit
277 can be changed to 1,024 (KiB), 1,048,576 (MiB), or 1,073,741,824 (GiB)
281 Dump the compiled packet-matching code in a human readable form to
282 standard output and stop.
284 Please mind that although code compilation is always DLT-specific,
285 typically it is impossible (and unnecessary) to specify which DLT to use
286 for the dump because \fItcpdump\fP uses either the DLT of the input pcap
289 or the default DLT of the network interface specified with
291 or the particular DLT of the network interface specified with
295 respectively. In these cases the dump shows the same exact code that
296 would filter the input file or the network interface without
299 However, when neither
303 is specified, specifying
305 prevents \fItcpdump\fP from guessing a suitable network interface (see
307 In this case the DLT defaults to EN10MB and can be set to another valid
312 Dump packet-matching code as a
317 Dump packet-matching code as decimal numbers (preceded with a count).
322 .B \-\-list\-interfaces
324 Print the list of the network interfaces available on the system and on
327 can capture packets. For each network interface, a number and an
328 interface name, possibly followed by a text description of the
329 interface, are printed. The interface name or the number can be supplied
332 flag to specify an interface on which to capture.
334 This can be useful on systems that don't have a command to list them
335 (e.g., Windows systems, or UNIX systems lacking
336 .BR "ifconfig \-a" );
337 the number can be useful on Windows 2000 and later systems, where the
338 interface name is a somewhat complex string.
342 flag will not be supported if
344 was built with an older version of
347 .BR pcap_findalldevs (3PCAP)
351 Print the link-level header on each dump line. This can be used, for
352 example, to print MAC layer addresses for protocols such as Ethernet and
356 Use \fIspi@ipaddr algo:secret\fP for decrypting IPsec ESP packets that
357 are addressed to \fIaddr\fP and contain Security Parameter Index value
358 \fIspi\fP. This combination may be repeated with comma or newline separation.
360 Note that setting the secret for IPv4 ESP packets is supported at this time.
367 \fBcast128-cbc\fP, or
369 The default is \fBdes-cbc\fP.
370 The ability to decrypt packets is only present if \fItcpdump\fP was compiled
371 with cryptography enabled.
373 \fIsecret\fP is the ASCII text for ESP secret key.
374 If preceded by 0x, then a hex value will be read.
376 The option assumes RFC 2406 ESP, not RFC 1827 ESP.
377 The option is only for debugging purposes, and
378 the use of this option with a true `secret' key is discouraged.
379 By presenting IPsec secret key onto command line
380 you make it visible to others, via
384 In addition to the above syntax, the syntax \fIfile name\fP may be used
385 to have tcpdump read the provided file in. The file is opened upon
386 receiving the first ESP packet, so any special permissions that tcpdump
387 may have been given should already have been given up.
390 Print `foreign' IPv4 addresses numerically rather than symbolically
391 (this option is intended to get around serious brain damage in
392 Sun's NIS server \(em usually it hangs forever translating non-local
395 The test for `foreign' IPv4 addresses is done using the IPv4 address and
396 netmask of the interface on which capture is being done. If that
397 address or netmask are not available, available, either because the
398 interface on which capture is being done has no address or netmask or
399 because the capture is being done on the Linux "any" interface, which
400 can capture on more than one interface, this option will not work
404 Use \fIfile\fP as input for the filter expression.
405 An additional expression given on the command line is ignored.
407 .BI \-G " rotate_seconds"
408 If specified, rotates the dump file specified with the
410 option every \fIrotate_seconds\fP seconds.
411 Savefiles will have the name specified by
413 which should include a time format as defined by
415 If no time format is specified, each new file will overwrite the previous.
416 Whenever a generated filename is not unique, tcpdump will overwrite the
417 pre-existing data; providing a time specification that is coarser than the
418 capture period is therefore not advised.
420 If used in conjunction with the
422 option, filenames will take the form of `\fIfile\fP<count>'.
429 Print the tcpdump and libpcap version strings, print a usage message,
434 Print the tcpdump and libpcap version strings and exit.
437 Attempt to detect 802.11s draft mesh headers.
442 .BI \-\-interface= interface
444 Listen, report the list of link-layer types, report the list of time
445 stamp types, or report the results of compiling a filter expression on
446 \fIinterface\fP. If unspecified and if the
448 flag is not given, \fItcpdump\fP searches the system
449 interface list for the lowest numbered, configured up interface
450 (excluding loopback), which may turn out to be, for example, ``eth0''.
452 On Linux systems with 2.2 or later kernels, an
454 argument of ``any'' can be used to capture packets from all interfaces.
455 Note that captures on the ``any'' device will not be done in promiscuous
460 flag is supported, an interface number as printed by that flag can be
463 argument, if no interface on the system has that number as a name.
470 Put the interface in "monitor mode"; this is supported only on IEEE
471 802.11 Wi-Fi interfaces, and supported only on some operating systems.
473 Note that in monitor mode the adapter might disassociate from the
474 network with which it's associated, so that you will not be able to use
475 any wireless networks with that adapter. This could prevent accessing
476 files on a network server, or resolving host names or network addresses,
477 if you are capturing in monitor mode and are not connected to another
478 network with another adapter.
480 This flag will affect the output of the
484 isn't specified, only those link-layer types available when not in
485 monitor mode will be shown; if
487 is specified, only those link-layer types available when in monitor mode
490 .BI \-\-immediate\-mode
491 Capture in "immediate mode". In this mode, packets are delivered to
492 tcpdump as soon as they arrive, rather than being buffered for
493 efficiency. This is the default when printing packets rather than
494 saving packets to a ``savefile'' if the packets are being printed to a
495 terminal rather than to a file or pipe.
497 .BI \-j " tstamp_type"
500 .BI \-\-time\-stamp\-type= tstamp_type
502 Set the time stamp type for the capture to \fItstamp_type\fP. The names
503 to use for the time stamp types are given in
504 .BR \%pcap-tstamp (@MAN_MISC_INFO@);
505 not all the types listed there will necessarily be valid for any given
511 .B \-\-list\-time\-stamp\-types
513 List the supported time stamp types for the interface and exit. If the
514 time stamp type cannot be set for the interface, no time stamp types are
517 .BI \-\-time\-stamp\-precision= tstamp_precision
518 When capturing, set the time stamp precision for the capture to
519 \fItstamp_precision\fP. Note that availability of high precision time
520 stamps (nanoseconds) and their actual accuracy is platform and hardware
521 dependent. Also note that when writing captures made with nanosecond
522 accuracy to a savefile, the time stamps are written with nanosecond
523 resolution, and the file is written with a different magic number, to
524 indicate that the time stamps are in seconds and nanoseconds; not all
525 programs that read pcap savefiles will be able to read those captures.
527 When reading a savefile, convert time stamps to the precision specified
528 by \fItimestamp_precision\fP, and display them with that resolution. If
529 the precision specified is less than the precision of time stamps in the
530 file, the conversion will lose precision.
532 The supported values for \fItimestamp_precision\fP are \fBmicro\fP for
533 microsecond resolution and \fBnano\fP for nanosecond resolution. The
534 default is microsecond resolution.
541 Shorthands for \fB\-\-time\-stamp\-precision=micro\fP or
542 \fB\-\-time\-stamp\-precision=nano\fP, adjusting the time stamp
543 precision accordingly. When reading packets from a savefile, using
544 \fB\-\-micro\fP truncates time stamps if the savefile was created with
545 nanosecond precision. In contrast, a savefile created with microsecond
546 precision will have trailing zeroes added to the time stamp when
547 \fB\-\-nano\fP is used.
552 .B \-\-dont\-verify\-checksums
554 Don't attempt to verify IP, TCP, or UDP checksums. This is useful for
555 interfaces that perform some or all of those checksum calculation in
556 hardware; otherwise, all outgoing TCP checksums will be flagged as bad.
559 Make stdout line buffered.
560 Useful if you want to see the data
567 \fBtcpdump \-l | tee dat\fP
577 \fBtcpdump \-l > dat & tail \-f dat\fP
582 Note that on Windows,``line buffered'' means ``unbuffered'', so that
583 WinDump will write each character individually if
590 in its behavior, but it will cause output to be ``packet-buffered'', so
591 that the output is written to stdout at the end of each packet rather
592 than at the end of each line; this is buffered on all platforms,
598 .B \-\-list\-data\-link\-types
600 List the known data link types for the interface, in the specified mode,
601 and exit. The list of known data link types may be dependent on the
602 specified mode; for example, on some platforms, a Wi-Fi interface might
603 support one set of data link types when not in monitor mode (for
604 example, it might support only fake Ethernet headers, or might support
605 802.11 headers but not support 802.11 headers with radio information)
606 and another set of data link types when in monitor mode (for example, it
607 might support 802.11 headers, or 802.11 headers with radio information,
608 only in monitor mode).
611 Load SMI MIB module definitions from file \fImodule\fR.
613 can be used several times to load several MIB modules into \fItcpdump\fP.
616 Use \fIsecret\fP as a shared secret for validating the digests found in
617 TCP segments with the TCP-MD5 option (RFC 2385), if present.
620 Don't convert addresses (i.e., host addresses, port numbers, etc.) to names.
623 Don't print domain name qualification of host names.
625 if you give this flag then \fItcpdump\fP will print ``nic''
626 instead of ``nic.ddn.mil''.
633 Print an optional packet number at the beginning of the line.
640 Do not run the packet-matching code optimizer.
642 if you suspect a bug in the optimizer.
647 .B \-\-no\-promiscuous\-mode
649 \fIDon't\fP put the interface
650 into promiscuous mode.
651 Note that the interface might be in promiscuous
652 mode for some other reason; hence, `-p' cannot be used as an abbreviation for
653 `ether host {local-hw-addr} or ether broadcast'.
656 Print parsed packet output, even if the raw packets are being saved to a
661 .BI \-\-print\-sampling= nth
663 Print every \fInth\fP packet. This option enables the \fB--print\fP flag.
665 Unprinted packets are not parsed, which decreases processing time. Setting
666 \fInth\fP to \fB100\fP for example, will (counting from 1) parse and print the
667 100th packet, 200th patcket, 300th packet, and so on.
669 This option also enables the \fB-S\fP flag, as relative TCP sequence
670 numbers are not tracked for unprinted packets.
675 .BI \-\-direction= direction
677 Choose send/receive direction \fIdirection\fR for which packets should be
678 captured. Possible values are `in', `out' and `inout'. Not available
682 Quick (quiet?) output.
683 Print less protocol information so output
687 Read packets from \fIfile\fR (which was created with the
689 option or by other tools that write pcap or pcapng files).
690 Standard input is used if \fIfile\fR is ``-''.
695 .B \-\-absolute\-tcp\-sequence\-numbers
697 Print absolute, rather than relative, TCP sequence numbers.
702 .BI \-\-snapshot\-length= snaplen
704 Snarf \fIsnaplen\fP bytes of data from each packet rather than the
705 default of 262144 bytes.
706 Packets truncated because of a limited snapshot
707 are indicated in the output with ``[|\fIproto\fP]'', where \fIproto\fP
708 is the name of the protocol level at which the truncation has occurred.
710 Note that taking larger snapshots both increases
711 the amount of time it takes to process packets and, effectively,
712 decreases the amount of packet buffering.
713 This may cause packets to be
715 Note also that taking smaller snapshots will discard data from protocols
716 above the transport layer, which loses information that may be
717 important. NFS and AFS requests and replies, for example, are very
718 large, and much of the detail won't be available if a too-short snapshot
721 If you need to reduce the snapshot size below the default, you should
722 limit \fIsnaplen\fP to the smallest number that will capture the
723 protocol information you're interested in. Setting
724 \fIsnaplen\fP to 0 sets it to the default of 262144,
725 for backwards compatibility with recent older versions of
729 Force packets selected by "\fIexpression\fP" to be interpreted the
730 specified \fItype\fR.
731 Currently known types are
732 \fBaodv\fR (Ad-hoc On-demand Distance Vector protocol),
733 \fBcarp\fR (Common Address Redundancy Protocol),
734 \fBcnfp\fR (Cisco NetFlow protocol),
735 \fBdomain\fR (Domain Name System),
736 \fBlmp\fR (Link Management Protocol),
737 \fBpgm\fR (Pragmatic General Multicast),
738 \fBpgm_zmtp1\fR (ZMTP/1.0 inside PGM/EPGM),
739 \fBptp\fR (Precision Time Protocol),
741 \fBradius\fR (RADIUS),
742 \fBresp\fR (REdis Serialization Protocol),
743 \fBrpc\fR (Remote Procedure Call),
744 \fBrtcp\fR (Real-Time Applications control protocol),
745 \fBrtp\fR (Real-Time Applications protocol),
746 \fBsnmp\fR (Simple Network Management Protocol),
747 \fBsomeip\fR (SOME/IP),
748 \fBtftp\fR (Trivial File Transfer Protocol),
749 \fBvat\fR (Visual Audio Tool),
750 \fBvxlan\fR (Virtual eXtensible Local Area Network),
751 \fBwb\fR (distributed White Board)
753 \fBzmtp1\fR (ZeroMQ Message Transport Protocol 1.0).
755 Note that the \fBpgm\fR type above affects UDP interpretation only, the native
756 PGM is always recognised as IP protocol 113 regardless. UDP-encapsulated PGM is
757 often called "EPGM" or "PGM/UDP".
759 Note that the \fBpgm_zmtp1\fR type above affects interpretation of both native
760 PGM and UDP at once. During the native PGM decoding the application data of an
761 ODATA/RDATA packet would be decoded as a ZeroMQ datagram with ZMTP/1.0 frames.
762 During the UDP decoding in addition to that any UDP packet would be treated as
763 an encapsulated PGM packet.
766 \fIDon't\fP print a timestamp on each dump line.
769 Print the timestamp, as seconds since January 1, 1970, 00:00:00, UTC, and
770 fractions of a second since that time, on each dump line.
773 Print a delta (microsecond or nanosecond resolution depending on the
774 .B \-\-time\-stamp-precision
775 option) between current and previous line on each dump line.
776 The default is microsecond resolution.
779 Print a timestamp, as hours, minutes, seconds, and fractions of a second
780 since midnight, preceded by the date, on each dump line.
783 Print a delta (microsecond or nanosecond resolution depending on the
784 .B \-\-time\-stamp-precision
785 option) between current and first line on each dump line.
786 The default is microsecond resolution.
789 Print undecoded NFS handles.
794 .B \-\-packet\-buffered
798 option is not specified, or if it is specified but the
800 flag is also specified, make the printed packet output
801 ``packet-buffered''; i.e., as the description of the contents of each
802 packet is printed, it will be written to the standard output, rather
803 than, when not writing to a terminal, being written only when the output
808 option is specified, make the saved raw packet output
809 ``packet-buffered''; i.e., as each packet is saved, it will be written
810 to the output file, rather than being written only when the output
815 flag will not be supported if
817 was built with an older version of
820 .BR pcap_dump_flush (3PCAP)
824 When parsing and printing, produce (slightly more) verbose output.
825 For example, the time to live,
826 identification, total length and options in an IP packet are printed.
827 Also enables additional packet integrity checks such as verifying the
828 IP and ICMP header checksum.
830 When writing to a file with the
832 option and at the same time not reading from a file with the
834 option, report to stderr, once per second, the number of packets captured. In
835 Solaris, FreeBSD and possibly other operating systems this periodic update
836 currently can cause loss of captured packets on their way from the kernel to
840 Even more verbose output.
841 For example, additional fields are
842 printed from NFS reply packets, and SMB packets are fully decoded.
845 Even more verbose output.
847 telnet \fBSB\fP ... \fBSE\fP options
851 Telnet options are printed in hex as well.
854 Read a list of filenames from \fIfile\fR. Standard input is used
855 if \fIfile\fR is ``-''.
858 Write the raw packets to \fIfile\fR rather than parsing and printing
860 They can later be printed with the \-r option.
861 Standard output is used if \fIfile\fR is ``-''.
863 This output will be buffered if written to a file or pipe, so a program
864 reading from the file or pipe may not see packets for an arbitrary
865 amount of time after they are received. Use the
867 flag to cause packets to be written as soon as they are received.
869 The MIME type \fIapplication/vnd.tcpdump.pcap\fP has been registered
870 with IANA for \fIpcap\fP files. The filename extension \fI.pcap\fP
871 appears to be the most commonly used along with \fI.cap\fP and
872 \fI.dmp\fP. \fITcpdump\fP itself doesn't check the extension when
873 reading capture files and doesn't add an extension when writing them
874 (it uses magic numbers in the file header instead). However, many
875 operating systems and applications will use the extension if it is
876 present and adding one (e.g. .pcap) is recommended.
879 .BR \%pcap-savefile (@MAN_FILE_FORMATS@)
880 for a description of the file format.
883 Used in conjunction with the
885 option, this will limit the number
886 of files created to the specified number, and begin overwriting files
887 from the beginning, thus creating a 'rotating' buffer.
888 In addition, it will name
889 the files with enough leading 0s to support the maximum number of
890 files, allowing them to sort correctly.
892 Used in conjunction with the
894 option, this will limit the number of rotated dump files that get
895 created, exiting with status 0 when reaching the limit.
897 If used in conjunction with both
903 option will currently be ignored, and will only affect the file name.
906 When parsing and printing,
907 in addition to printing the headers of each packet, print the data of
908 each packet (minus its link level header) in hex.
909 The smaller of the entire packet or
911 bytes will be printed. Note that this is the entire link-layer
912 packet, so for link layers that pad (e.g. Ethernet), the padding bytes
913 will also be printed when the higher layer packet is shorter than the
915 In the current implementation this flag may have the same effect as
917 if the packet is truncated.
920 When parsing and printing,
921 in addition to printing the headers of each packet, print the data of
924 its link level header, in hex.
927 When parsing and printing,
928 in addition to printing the headers of each packet, print the data of
929 each packet (minus its link level header) in hex and ASCII.
930 This is very handy for analysing new protocols.
931 In the current implementation this flag may have the same effect as
933 if the packet is truncated.
936 When parsing and printing,
937 in addition to printing the headers of each packet, print the data of
940 its link level header, in hex and ASCII.
942 .BI \-y " datalinktype"
945 .BI \-\-linktype= datalinktype
947 Set the data link type to use while capturing packets (see
949 or just compiling and dumping packet-matching code (see
951 to \fIdatalinktype\fP.
953 .BI \-z " postrotate-command"
954 Used in conjunction with the
958 options, this will make
961 .I postrotate-command file
964 is the savefile being closed after each rotation. For example, specifying
968 will compress each savefile using gzip or bzip2.
970 Note that tcpdump will run the command in parallel to the capture, using
971 the lowest priority so that this doesn't disturb the capture process.
973 And in case you would like to use a command that itself takes flags or
974 different arguments, you can always write a shell script that will take the
975 savefile name as the only argument, make the flags & arguments arrangements
976 and execute the command that you want.
981 .BI \-\-relinquish\-privileges= user
985 is running as root, after opening the capture device or input savefile,
986 but before opening any savefiles for output, change the user ID to
988 and the group ID to the primary group of
991 This behavior can also be enabled by default at compile time.
992 .IP "\fI expression\fP"
994 selects which packets will be dumped.
995 If no \fIexpression\fP
996 is given, all packets on the net will be dumped.
998 only packets for which \fIexpression\fP is `true' will be dumped.
1000 For the \fIexpression\fP syntax, see
1001 .BR \%pcap-filter (@MAN_MISC_INFO@).
1003 The \fIexpression\fP argument can be passed to \fItcpdump\fP as either a single
1004 Shell argument, or as multiple Shell arguments, whichever is more convenient.
1005 Generally, if the expression contains Shell metacharacters, such as
1006 backslashes used to escape protocol names, it is easier to pass it as
1007 a single, quoted argument rather than to escape the Shell
1009 Multiple arguments are concatenated with spaces before being parsed.
1012 To print all packets arriving at or departing from \fIsundown\fP:
1015 \fBtcpdump host sundown\fP
1019 To print traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR:
1022 \fBtcpdump host helios and \\( hot or ace \\)\fP
1026 To print all IP packets between \fIace\fR and any host except \fIhelios\fR:
1029 \fBtcpdump ip host ace and not helios\fP
1033 To print all traffic between local hosts and hosts at Berkeley:
1037 tcpdump net ucb-ether
1041 To print all ftp traffic through internet gateway \fIsnup\fP:
1042 (note that the expression is quoted to prevent the shell from
1043 (mis-)interpreting the parentheses):
1047 tcpdump 'gateway snup and (port ftp or ftp-data)'
1051 To print traffic neither sourced from nor destined for local hosts
1052 (if you gateway to one other net, this stuff should never make it
1053 onto your local net).
1057 tcpdump ip and not net \fIlocalnet\fP
1061 To print the start and end packets (the SYN and FIN packets) of each
1062 TCP conversation that involves a non-local host.
1066 tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-fin) != 0 and not src and dst net \fIlocalnet\fP'
1070 To print the TCP packets with flags RST and ACK both set.
1071 (i.e. select only the RST and ACK flags in the flags field, and if the result
1072 is "RST and ACK both set", match)
1076 tcpdump 'tcp[tcpflags] & (tcp-rst|tcp-ack) == (tcp-rst|tcp-ack)'
1080 To print all IPv4 HTTP packets to and from port 80, i.e. print only
1081 packets that contain data, not, for example, SYN and FIN packets and
1082 ACK-only packets. (IPv6 is left as an exercise for the reader.)
1086 tcpdump 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
1090 To print IP packets longer than 576 bytes sent through gateway \fIsnup\fP:
1094 tcpdump 'gateway snup and ip[2:2] > 576'
1098 To print IP broadcast or multicast packets that were
1100 sent via Ethernet broadcast or multicast:
1104 tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'
1108 To print all ICMP packets that are not echo requests/replies (i.e., not
1113 tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply'
1118 The output of \fItcpdump\fP is protocol dependent.
1120 gives a brief description and examples of most of the formats.
1128 By default, all output lines are preceded by a timestamp.
1130 is the current clock time in the form
1136 and is as accurate as the kernel's clock.
1137 The timestamp reflects the time the kernel applied a time stamp to the packet.
1138 No attempt is made to account for the time lag between when the network
1139 interface finished receiving the packet from the network and when the
1140 kernel applied a time stamp to the packet; that time lag could include a
1141 delay between the time when the network interface finished receiving a
1142 packet from the network and the time when an interrupt was delivered to
1143 the kernel to get it to read the packet and a delay between the time
1144 when the kernel serviced the `new packet' interrupt and the time when it
1145 applied a time stamp to the packet.
1149 If the '-e' option is given, the link level header is printed out.
1150 On Ethernets, the source and destination addresses, protocol,
1151 and packet length are printed.
1153 On FDDI networks, the '-e' option causes \fItcpdump\fP to print
1154 the `frame control' field, the source and destination addresses,
1155 and the packet length.
1156 (The `frame control' field governs the
1157 interpretation of the rest of the packet.
1158 Normal packets (such
1159 as those containing IP datagrams) are `async' packets, with a priority
1160 value between 0 and 7; for example, `\fBasync4\fR'.
1162 are assumed to contain an 802.2 Logical Link Control (LLC) packet;
1163 the LLC header is printed if it is \fInot\fR an ISO datagram or a
1164 so-called SNAP packet.
1166 On Token Ring networks, the '-e' option causes \fItcpdump\fP to print
1167 the `access control' and `frame control' fields, the source and
1168 destination addresses, and the packet length.
1169 As on FDDI networks,
1170 packets are assumed to contain an LLC packet.
1171 Regardless of whether
1172 the '-e' option is specified or not, the source routing information is
1173 printed for source-routed packets.
1175 On 802.11 networks, the '-e' option causes \fItcpdump\fP to print
1176 the `frame control' fields, all of the addresses in the 802.11 header,
1177 and the packet length.
1178 As on FDDI networks,
1179 packets are assumed to contain an LLC packet.
1181 \fI(N.B.: The following description assumes familiarity with
1182 the SLIP compression algorithm described in RFC 1144.)\fP
1184 On SLIP links, a direction indicator (``I'' for inbound, ``O'' for outbound),
1185 packet type, and compression information are printed out.
1186 The packet type is printed first.
1187 The three types are \fIip\fP, \fIutcp\fP, and \fIctcp\fP.
1188 No further link information is printed for \fIip\fR packets.
1189 For TCP packets, the connection identifier is printed following the type.
1190 If the packet is compressed, its encoded header is printed out.
1191 The special cases are printed out as
1192 \fB*S+\fIn\fR and \fB*SA+\fIn\fR, where \fIn\fR is the amount by which
1193 the sequence number (or sequence number and ack) has changed.
1194 If it is not a special case,
1195 zero or more changes are printed.
1196 A change is indicated by U (urgent pointer), W (window), A (ack),
1197 S (sequence number), and I (packet ID), followed by a delta (+n or -n),
1198 or a new value (=n).
1199 Finally, the amount of data in the packet and compressed header length
1202 For example, the following line shows an outbound compressed TCP packet,
1203 with an implicit connection identifier; the ack has changed by 6,
1204 the sequence number by 49, and the packet ID by 6; there are 3 bytes of
1205 data and 6 bytes of compressed header:
1208 \fBO ctcp * A+6 S+49 I+6 3 (6)\fP
1214 ARP/RARP output shows the type of request and its arguments.
1216 format is intended to be self explanatory.
1217 Here is a short sample taken from the start of an `rlogin' from
1218 host \fIrtsg\fP to host \fIcsam\fP:
1222 \f(CWarp who-has csam tell rtsg
1223 arp reply csam is-at CSAM\fR
1227 The first line says that rtsg sent an ARP packet asking
1228 for the Ethernet address of internet host csam.
1230 replies with its Ethernet address (in this example, Ethernet addresses
1231 are in caps and internet addresses in lower case).
1233 This would look less redundant if we had done \fItcpdump \-n\fP:
1237 \f(CWarp who-has 128.3.254.6 tell 128.3.254.68
1238 arp reply 128.3.254.6 is-at 02:07:01:00:01:c4\fP
1242 If we had done \fItcpdump \-e\fP, the fact that the first packet is
1243 broadcast and the second is point-to-point would be visible:
1247 \f(CWRTSG Broadcast 0806 64: arp who-has csam tell rtsg
1248 CSAM RTSG 0806 64: arp reply csam is-at CSAM\fR
1252 For the first packet this says the Ethernet source address is RTSG, the
1253 destination is the Ethernet broadcast address, the type field
1254 contained hex 0806 (type ETHER_ARP) and the total length was 64 bytes.
1258 If the link-layer header is not being printed, for IPv4 packets,
1259 \fBIP\fP is printed after the time stamp.
1263 flag is specified, information from the IPv4 header is shown in
1264 parentheses after the \fBIP\fP or the link-layer header.
1265 The general format of this information is:
1269 tos \fItos\fP, ttl \fIttl\fP, id \fIid\fP, offset \fIoffset\fP, flags [\fIflags\fP], proto \fIproto\fP, length \fIlength\fP, options (\fIoptions\fP)
1273 \fItos\fP is the type of service field; if the ECN bits are non-zero,
1274 those are reported as \fBECT(1)\fP, \fBECT(0)\fP, or \fBCE\fP.
1275 \fIttl\fP is the time-to-live; it is not reported if it is zero.
1276 \fIid\fP is the IP identification field.
1277 \fIoffset\fP is the fragment offset field; it is printed whether this is
1278 part of a fragmented datagram or not.
1279 \fIflags\fP are the MF and DF flags; \fB+\fP is reported if MF is set,
1280 and \fBDF\fP is reported if F is set. If neither are set, \fB.\fP is
1282 \fIproto\fP is the protocol ID field.
1283 \fIlength\fP is the total length field.
1284 \fIoptions\fP are the IP options, if any.
1286 Next, for TCP and UDP packets, the source and destination IP addresses
1287 and TCP or UDP ports, with a dot between each IP address and its
1288 corresponding port, will be printed, with a > separating the source and
1289 destination. For other protocols, the addresses will be printed, with
1290 a > separating the source and destination. Higher level protocol
1291 information, if any, will be printed after that.
1293 For fragmented IP datagrams, the first fragment contains the higher
1294 level protocol header; fragments after the first contain no higher level
1295 protocol header. Fragmentation information will be printed only with
1298 flag, in the IP header information, as described above.
1302 \fI(N.B.:The following description assumes familiarity with
1303 the TCP protocol described in RFC 793.
1304 If you are not familiar
1305 with the protocol, this description will not
1306 be of much use to you.)\fP
1308 The general format of a TCP protocol line is:
1312 \fIsrc\fP > \fIdst\fP: Flags [\fItcpflags\fP], seq \fIdata-seqno\fP, ack \fIackno\fP, win \fIwindow\fP, urg \fIurgent\fP, options [\fIopts\fP], length \fIlen\fP
1316 \fISrc\fP and \fIdst\fP are the source and destination IP
1317 addresses and ports.
1318 \fITcpflags\fP are some combination of S (SYN),
1319 F (FIN), P (PUSH), R (RST), U (URG), W (ECN CWR), E (ECN-Echo) or
1320 `.' (ACK), or `none' if no flags are set.
1321 \fIData-seqno\fP describes the portion of sequence space covered
1322 by the data in this packet (see example below).
1323 \fIAckno\fP is sequence number of the next data expected the other
1324 direction on this connection.
1325 \fIWindow\fP is the number of bytes of receive buffer space available
1326 the other direction on this connection.
1327 \fIUrg\fP indicates there is `urgent' data in the packet.
1328 \fIOpts\fP are TCP options (e.g., mss 1024).
1329 \fILen\fP is the length of payload data.
1331 \fIIptype\fR, \fISrc\fP, \fIdst\fP, and \fIflags\fP are always present.
1333 depend on the contents of the packet's TCP protocol header and
1334 are output only if appropriate.
1336 Here is the opening portion of an rlogin from host \fIrtsg\fP to
1341 \f(CWIP rtsg.1023 > csam.login: Flags [S], seq 768512:768512, win 4096, opts [mss 1024]
1342 IP csam.login > rtsg.1023: Flags [S.], seq, 947648:947648, ack 768513, win 4096, opts [mss 1024]
1343 IP rtsg.1023 > csam.login: Flags [.], ack 1, win 4096
1344 IP rtsg.1023 > csam.login: Flags [P.], seq 1:2, ack 1, win 4096, length 1
1345 IP csam.login > rtsg.1023: Flags [.], ack 2, win 4096
1346 IP rtsg.1023 > csam.login: Flags [P.], seq 2:21, ack 1, win 4096, length 19
1347 IP csam.login > rtsg.1023: Flags [P.], seq 1:2, ack 21, win 4077, length 1
1348 IP csam.login > rtsg.1023: Flags [P.], seq 2:3, ack 21, win 4077, urg 1, length 1
1349 IP csam.login > rtsg.1023: Flags [P.], seq 3:4, ack 21, win 4077, urg 1, length 1\fR
1353 The first line says that TCP port 1023 on rtsg sent a packet
1356 The \fBS\fP indicates that the \fISYN\fP flag was set.
1357 The packet sequence number was 768512 and it contained no data.
1358 (The notation is `first:last' which means `sequence
1360 up to but not including \fIlast\fP'.)
1361 There was no piggy-backed ACK, the available receive window was 4096
1362 bytes and there was a max-segment-size option requesting an MSS of
1365 Csam replies with a similar packet except it includes a piggy-backed
1367 Rtsg then ACKs csam's SYN.
1368 The `.' means the ACK flag was set.
1369 The packet contained no data so there is no data sequence number or length.
1370 Note that the ACK sequence
1371 number is a small integer (1).
1372 The first time \fItcpdump\fP sees a
1373 TCP `conversation', it prints the sequence number from the packet.
1374 On subsequent packets of the conversation, the difference between
1375 the current packet's sequence number and this initial sequence number
1377 This means that sequence numbers after the
1378 first can be interpreted
1379 as relative byte positions in the conversation's data stream (with the
1380 first data byte each direction being `1').
1381 `-S' will override this
1382 feature, causing the original sequence numbers to be output.
1384 On the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20
1385 in the rtsg \(-> csam side of the conversation).
1386 The PUSH flag is set in the packet.
1387 On the 7th line, csam says it's received data sent by rtsg up to
1388 but not including byte 21.
1389 Most of this data is apparently sitting in the
1390 socket buffer since csam's receive window has gotten 19 bytes smaller.
1391 Csam also sends one byte of data to rtsg in this packet.
1392 On the 8th and 9th lines,
1393 csam sends two bytes of urgent, pushed data to rtsg.
1395 If the snapshot was small enough that \fItcpdump\fP didn't capture
1396 the full TCP header, it interprets as much of the header as it can
1397 and then reports ``[|\fItcp\fP]'' to indicate the remainder could not
1399 If the header contains a bogus option (one with a length
1400 that's either too small or beyond the end of the header), \fItcpdump\fP
1401 reports it as ``[\fIbad opt\fP]'' and does not interpret any further
1402 options (since it's impossible to tell where they start).
1404 length indicates options are present but the IP datagram length is not
1405 long enough for the options to actually be there, \fItcpdump\fP reports
1406 it as ``[\fIbad hdr length\fP]''.
1408 .B Capturing TCP packets with particular flag combinations (SYN-ACK, URG-ACK, etc.)
1410 There are 8 bits in the control bits section of the TCP header:
1412 .I CWR | ECE | URG | ACK | PSH | RST | SYN | FIN
1414 Let's assume that we want to watch packets used in establishing
1416 Recall that TCP uses a 3-way handshake protocol
1417 when it initializes a new connection; the connection sequence with
1418 regard to the TCP control bits is
1424 2) Recipient responds with SYN, ACK
1430 Now we're interested in capturing packets that have only the
1431 SYN bit set (Step 1).
1432 Note that we don't want packets from step 2
1433 (SYN-ACK), just a plain initial SYN.
1434 What we need is a correct filter
1435 expression for \fItcpdump\fP.
1437 Recall the structure of a TCP header without options:
1441 -----------------------------------------------------------------
1442 | source port | destination port |
1443 -----------------------------------------------------------------
1445 -----------------------------------------------------------------
1446 | acknowledgment number |
1447 -----------------------------------------------------------------
1448 | HL | rsvd |C|E|U|A|P|R|S|F| window size |
1449 -----------------------------------------------------------------
1450 | TCP checksum | urgent pointer |
1451 -----------------------------------------------------------------
1454 A TCP header usually holds 20 octets of data, unless options are
1456 The first line of the graph contains octets 0 - 3, the
1457 second line shows octets 4 - 7 etc.
1459 Starting to count with 0, the relevant TCP control bits are contained
1464 ----------------|---------------|---------------|----------------
1465 | HL | rsvd |C|E|U|A|P|R|S|F| window size |
1466 ----------------|---------------|---------------|----------------
1467 | | 13th octet | | |
1470 Let's have a closer look at octet no. 13:
1480 These are the TCP control bits we are interested
1482 We have numbered the bits in this octet from 0 to 7, right to
1483 left, so the PSH bit is bit number 3, while the URG bit is number 5.
1485 Recall that we want to capture packets with only SYN set.
1486 Let's see what happens to octet 13 if a TCP datagram arrives
1487 with the SYN bit set in its header:
1498 control bits section we see that only bit number 1 (SYN) is set.
1500 Assuming that octet number 13 is an 8-bit unsigned integer in
1501 network byte order, the binary value of this octet is
1505 and its decimal representation is
1509 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 0*2 + 1*2 + 0*2 = 2
1512 We're almost done, because now we know that if only SYN is set,
1513 the value of the 13th octet in the TCP header, when interpreted
1514 as a 8-bit unsigned integer in network byte order, must be exactly 2.
1516 This relationship can be expressed as
1522 We can use this expression as the filter for \fItcpdump\fP in order
1523 to watch packets which have only SYN set:
1526 tcpdump -i xl0 tcp[13] == 2
1529 The expression says "let the 13th octet of a TCP datagram have
1530 the decimal value 2", which is exactly what we want.
1532 Now, let's assume that we need to capture SYN packets, but we
1533 don't care if ACK or any other TCP control bit is set at the
1535 Let's see what happens to octet 13 when a TCP datagram
1536 with SYN-ACK set arrives:
1546 Now bits 1 and 4 are set in the 13th octet.
1552 which translates to decimal
1556 0*2 + 0*2 + 0*2 + 1*2 + 0*2 + 0*2 + 1*2 + 0*2 = 18
1559 Now we can't just use 'tcp[13] == 18' in the \fItcpdump\fP filter
1560 expression, because that would select only those packets that have
1561 SYN-ACK set, but not those with only SYN set.
1562 Remember that we don't care
1563 if ACK or any other control bit is set as long as SYN is set.
1565 In order to achieve our goal, we need to logically AND the
1566 binary value of octet 13 with some other value to preserve
1568 We know that we want SYN to be set in any case,
1569 so we'll logically AND the value in the 13th octet with
1570 the binary value of a SYN:
1574 00010010 SYN-ACK 00000010 SYN
1575 AND 00000010 (we want SYN) AND 00000010 (we want SYN)
1577 = 00000010 = 00000010
1580 We see that this AND operation delivers the same result
1581 regardless whether ACK or another TCP control bit is set.
1582 The decimal representation of the AND value as well as
1583 the result of this operation is 2 (binary 00000010),
1584 so we know that for packets with SYN set the following
1585 relation must hold true:
1587 ( ( value of octet 13 ) AND ( 2 ) ) == ( 2 )
1589 This points us to the \fItcpdump\fP filter expression
1592 tcpdump -i xl0 'tcp[13] & 2 == 2'
1595 Some offsets and field values may be expressed as names
1596 rather than as numeric values. For example tcp[13] may
1597 be replaced with tcp[tcpflags]. The following TCP flag
1598 field values are also available: tcp-fin, tcp-syn, tcp-rst,
1599 tcp-push, tcp-ack, tcp-urg.
1601 This can be demonstrated as:
1604 tcpdump -i xl0 'tcp[tcpflags] & tcp-push != 0'
1607 Note that you should use single quotes or a backslash
1608 in the expression to hide the AND ('&') special character
1614 UDP format is illustrated by this rwho packet:
1618 \f(CWactinide.who > broadcast.who: udp 84\fP
1622 This says that port \fIwho\fP on host \fIactinide\fP sent a UDP
1623 datagram to port \fIwho\fP on host \fIbroadcast\fP, the Internet
1625 The packet contained 84 bytes of user data.
1627 Some UDP services are recognized (from the source or destination
1628 port number) and the higher level protocol information printed.
1629 In particular, Domain Name service requests (RFC 1034/1035) and Sun
1630 RPC calls (RFC 1050) to NFS.
1632 TCP or UDP Name Server Requests
1634 \fI(N.B.:The following description assumes familiarity with
1635 the Domain Service protocol described in RFC 1035.
1636 If you are not familiar
1637 with the protocol, the following description will appear to be written
1640 Name server requests are formatted as
1644 \fIsrc > dst: id op? flags qtype qclass name (len)\fP
1646 \f(CWh2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)\fR
1650 Host \fIh2opolo\fP asked the domain server on \fIhelios\fP for an
1651 address record (qtype=A) associated with the name \fIucbvax.berkeley.edu.\fP
1652 The query id was `3'.
1653 The `+' indicates the \fIrecursion desired\fP flag
1655 The query length was 37 bytes, excluding the TCP or UDP and
1656 IP protocol headers.
1657 The query operation was the normal one, \fIQuery\fP,
1658 so the op field was omitted.
1659 If the op had been anything else, it would
1660 have been printed between the `3' and the `+'.
1661 Similarly, the qclass was the normal one,
1662 \fIC_IN\fP, and omitted.
1663 Any other qclass would have been printed
1664 immediately after the `A'.
1666 A few anomalies are checked and may result in extra fields enclosed in
1667 square brackets: If a query contains an answer, authority records or
1668 additional records section,
1673 are printed as `[\fIn\fPa]', `[\fIn\fPn]' or `[\fIn\fPau]' where \fIn\fP
1674 is the appropriate count.
1675 If any of the response bits are set (AA, RA or rcode) or any of the
1676 `must be zero' bits are set in bytes two and three, `[b2&3=\fIx\fP]'
1677 is printed, where \fIx\fP is the hex value of header bytes two and three.
1679 TCP or UDP Name Server Responses
1681 Name server responses are formatted as
1685 \fIsrc > dst: id op rcode flags a/n/au type class data (len)\fP
1687 \f(CWhelios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)
1688 helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)\fR
1692 In the first example, \fIhelios\fP responds to query id 3 from \fIh2opolo\fP
1693 with 3 answer records, 3 name server records and 7 additional records.
1694 The first answer record is type A (address) and its data is internet
1695 address 128.32.137.3.
1696 The total size of the response was 273 bytes,
1697 excluding TCP or UDP and IP headers.
1698 The op (Query) and response code
1699 (NoError) were omitted, as was the class (C_IN) of the A record.
1701 In the second example, \fIhelios\fP responds to query 2 with a
1702 response code of non-existent domain (NXDomain) with no answers,
1703 one name server and no authority records.
1704 The `*' indicates that
1705 the \fIauthoritative answer\fP bit was set.
1707 answers, no type, class or data were printed.
1709 Other flag characters that might appear are `\-' (recursion available,
1710 RA, \fInot\fP set) and `|' (truncated message, TC, set).
1712 `question' section doesn't contain exactly one entry, `[\fIn\fPq]'
1717 \fItcpdump\fP now includes fairly extensive SMB/CIFS/NBT decoding for data
1718 on UDP/137, UDP/138 and TCP/139.
1719 Some primitive decoding of IPX and
1720 NetBEUI SMB data is also done.
1722 By default a fairly minimal decode is done, with a much more detailed
1723 decode done if -v is used.
1724 Be warned that with -v a single SMB packet
1725 may take up a page or more, so only use -v if you really want all the
1728 For information on SMB packet formats and what all the fields mean see
1729 \%https://download.samba.org/pub/samba/specs/ and other online resources.
1730 The SMB patches were written by Andrew Tridgell
1733 NFS Requests and Replies
1735 Sun NFS (Network File System) requests and replies are printed as:
1739 \fIsrc.sport > dst.nfs: NFS request xid xid len op args\fP
1740 \fIsrc.nfs > dst.dport: NFS reply xid xid reply stat len op results\fP
1743 sushi.1023 > wrl.nfs: NFS request xid 26377
1744 112 readlink fh 21,24/10.73165
1745 wrl.nfs > sushi.1023: NFS reply xid 26377
1746 reply ok 40 readlink "../var"
1747 sushi.1022 > wrl.nfs: NFS request xid 8219
1748 144 lookup fh 9,74/4096.6878 "xcolors"
1749 wrl.nfs > sushi.1022: NFS reply xid 8219
1750 reply ok 128 lookup fh 9,74/4134.3150
1755 In the first line, host \fIsushi\fP sends a transaction with id \fI26377\fP
1757 The request was 112 bytes,
1758 excluding the UDP and IP headers.
1759 The operation was a \fIreadlink\fP
1760 (read symbolic link) on file handle (\fIfh\fP) 21,24/10.731657119.
1761 (If one is lucky, as in this case, the file handle can be interpreted
1762 as a major,minor device number pair, followed by the inode number and
1763 generation number.) In the second line, \fIwrl\fP replies `ok' with
1764 the same transaction id and the contents of the link.
1766 In the third line, \fIsushi\fP asks (using a new transaction id) \fIwrl\fP
1767 to lookup the name `\fIxcolors\fP' in directory file 9,74/4096.6878. In
1768 the fourth line, \fIwrl\fP sends a reply with the respective transaction id.
1770 Note that the data printed
1771 depends on the operation type.
1772 The format is intended to be self
1773 explanatory if read in conjunction with
1774 an NFS protocol spec.
1775 Also note that older versions of tcpdump printed NFS packets in a
1776 slightly different format: the transaction id (xid) would be printed
1777 instead of the non-NFS port number of the packet.
1779 If the \-v (verbose) flag is given, additional information is printed.
1785 sushi.1023 > wrl.nfs: NFS request xid 79658
1786 148 read fh 21,11/12.195 8192 bytes @ 24576
1787 wrl.nfs > sushi.1023: NFS reply xid 79658
1788 reply ok 1472 read REG 100664 ids 417/0 sz 29388
1793 (\-v also prints the IP header TTL, ID, length, and fragmentation fields,
1794 which have been omitted from this example.) In the first line,
1795 \fIsushi\fP asks \fIwrl\fP to read 8192 bytes from file 21,11/12.195,
1796 at byte offset 24576.
1797 \fIWrl\fP replies `ok'; the packet shown on the
1798 second line is the first fragment of the reply, and hence is only 1472
1799 bytes long (the other bytes will follow in subsequent fragments, but
1800 these fragments do not have NFS or even UDP headers and so might not be
1801 printed, depending on the filter expression used).
1802 Because the \-v flag
1803 is given, some of the file attributes (which are returned in addition
1804 to the file data) are printed: the file type (``REG'', for regular file),
1805 the file mode (in octal), the UID and GID, and the file size.
1807 If the \-v flag is given more than once, even more details are printed.
1809 NFS reply packets do not explicitly identify the RPC operation.
1811 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
1812 replies using the transaction ID.
1813 If a reply does not closely follow the
1814 corresponding request, it might not be parsable.
1816 AFS Requests and Replies
1818 Transarc AFS (Andrew File System) requests and replies are printed
1824 \fIsrc.sport > dst.dport: rx packet-type\fP
1825 \fIsrc.sport > dst.dport: rx packet-type service call call-name args\fP
1826 \fIsrc.sport > dst.dport: rx packet-type service reply call-name args\fP
1829 elvis.7001 > pike.afsfs:
1830 rx data fs call rename old fid 536876964/1/1 ".newsrc.new"
1831 new fid 536876964/1/1 ".newsrc"
1832 pike.afsfs > elvis.7001: rx data fs reply rename
1837 In the first line, host elvis sends a RX packet to pike.
1839 a RX data packet to the fs (fileserver) service, and is the start of
1841 The RPC call was a rename, with the old directory file id
1842 of 536876964/1/1 and an old filename of `.newsrc.new', and a new directory
1843 file id of 536876964/1/1 and a new filename of `.newsrc'.
1845 responds with a RPC reply to the rename call (which was successful, because
1846 it was a data packet and not an abort packet).
1848 In general, all AFS RPCs are decoded at least by RPC call name.
1850 AFS RPCs have at least some of the arguments decoded (generally only
1851 the `interesting' arguments, for some definition of interesting).
1853 The format is intended to be self-describing, but it will probably
1854 not be useful to people who are not familiar with the workings of
1857 If the -v (verbose) flag is given twice, acknowledgement packets and
1858 additional header information is printed, such as the RX call ID,
1859 call number, sequence number, serial number, and the RX packet flags.
1861 If the -v flag is given twice, additional information is printed,
1862 such as the RX call ID, serial number, and the RX packet flags.
1863 The MTU negotiation information is also printed from RX ack packets.
1865 If the -v flag is given three times, the security index and service id
1868 Error codes are printed for abort packets, with the exception of Ubik
1869 beacon packets (because abort packets are used to signify a yes vote
1870 for the Ubik protocol).
1872 AFS reply packets do not explicitly identify the RPC operation.
1874 \fItcpdump\fP keeps track of ``recent'' requests, and matches them to the
1875 replies using the call number and service ID.
1876 If a reply does not closely
1878 corresponding request, it might not be parsable.
1881 KIP AppleTalk (DDP in UDP)
1883 AppleTalk DDP packets encapsulated in UDP datagrams are de-encapsulated
1884 and dumped as DDP packets (i.e., all the UDP header information is
1888 is used to translate AppleTalk net and node numbers to names.
1889 Lines in this file have the form
1901 The first two lines give the names of AppleTalk networks.
1903 line gives the name of a particular host (a host is distinguished
1904 from a net by the 3rd octet in the number \-
1905 a net number \fImust\fP have two octets and a host number \fImust\fP
1906 have three octets.) The number and name should be separated by
1907 whitespace (blanks or tabs).
1910 file may contain blank lines or comment lines (lines starting with
1913 AppleTalk addresses are printed in the form
1919 \f(CW144.1.209.2 > icsd-net.112.220
1920 office.2 > icsd-net.112.220
1921 jssmag.149.235 > icsd-net.2\fR
1927 doesn't exist or doesn't contain an entry for some AppleTalk
1928 host/net number, addresses are printed in numeric form.)
1929 In the first example, NBP (DDP port 2) on net 144.1 node 209
1930 is sending to whatever is listening on port 220 of net icsd node 112.
1931 The second line is the same except the full name of the source node
1932 is known (`office').
1933 The third line is a send from port 235 on
1934 net jssmag node 149 to broadcast on the icsd-net NBP port (note that
1935 the broadcast address (255) is indicated by a net name with no host
1936 number \- for this reason it's a good idea to keep node names and
1937 net names distinct in /etc/atalk.names).
1939 NBP (name binding protocol) and ATP (AppleTalk transaction protocol)
1940 packets have their contents interpreted.
1941 Other protocols just dump
1942 the protocol name (or number if no name is registered for the
1943 protocol) and packet size.
1945 \fBNBP packets\fP are formatted like the following examples:
1949 \f(CWicsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*"
1950 jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250
1951 techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186\fR
1955 The first line is a name lookup request for laserwriters sent by net icsd host
1956 112 and broadcast on net jssmag.
1957 The nbp id for the lookup is 190.
1958 The second line shows a reply for this request (note that it has the
1959 same id) from host jssmag.209 saying that it has a laserwriter
1960 resource named "RM1140" registered on port 250.
1962 another reply to the same request saying host techpit has laserwriter
1963 "techpit" registered on port 186.
1965 \fBATP packet\fP formatting is demonstrated by the following example:
1969 \f(CWjssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001
1970 helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000
1971 helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000
1972 helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000
1973 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
1974 helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000
1975 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
1976 helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000
1977 helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000
1978 jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001
1979 helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000
1980 helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000
1981 jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001
1982 jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002\fR
1986 Jssmag.209 initiates transaction id 12266 with host helios by requesting
1987 up to 8 packets (the `<0-7>').
1988 The hex number at the end of the line
1989 is the value of the `userdata' field in the request.
1991 Helios responds with 8 512-byte packets.
1992 The `:digit' following the
1993 transaction id gives the packet sequence number in the transaction
1994 and the number in parens is the amount of data in the packet,
1995 excluding the ATP header.
1996 The `*' on packet 7 indicates that the
1999 Jssmag.209 then requests that packets 3 & 5 be retransmitted.
2001 resends them then jssmag.209 releases the transaction.
2003 jssmag.209 initiates the next request.
2004 The `*' on the request
2005 indicates that XO (`exactly once') was \fInot\fP set.
2012 .BR \%pcap-savefile (@MAN_FILE_FORMATS@),
2013 .BR \%pcap-filter (@MAN_MISC_INFO@),
2014 .BR \%pcap-tstamp (@MAN_MISC_INFO@)
2018 .I https://www.iana.org/assignments/media-types/application/vnd.tcpdump.pcap
2023 The original authors are:
2027 Steven McCanne, all of the
2028 Lawrence Berkeley National Laboratory, University of California, Berkeley, CA.
2030 It is currently maintained by The Tcpdump Group.
2032 The current version is available via HTTPS:
2035 .I https://www.tcpdump.org/
2038 The original distribution is available via anonymous ftp:
2041 .I ftp://ftp.ee.lbl.gov/old/tcpdump.tar.Z
2044 IPv6/IPsec support is added by WIDE/KAME project.
2045 This program uses OpenSSL/LibreSSL, under specific configurations.
2047 To report a security issue please send an e-mail to \%security@tcpdump.org.
2049 To report bugs and other problems, contribute patches, request a
2050 feature, provide generic feedback etc. please see the file
2052 in the tcpdump source tree root.
2054 NIT doesn't let you watch your own outbound traffic, BPF will.
2055 We recommend that you use the latter.
2057 On Linux systems with 2.0[.x] kernels:
2059 packets on the loopback device will be seen twice;
2061 packet filtering cannot be done in the kernel, so that all packets must
2062 be copied from the kernel in order to be filtered in user mode;
2064 all of a packet, not just the part that's within the snapshot length,
2065 will be copied from the kernel (the 2.0[.x] packet capture mechanism, if
2066 asked to copy only part of a packet to userspace, will not report the
2067 true length of the packet; this would cause most IP packets to get an
2071 capturing on some PPP devices won't work correctly.
2073 We recommend that you upgrade to a 2.2 or later kernel.
2075 Some attempt should be made to reassemble IP fragments or, at least
2076 to compute the right length for the higher level protocol.
2078 Name server inverse queries are not dumped correctly: the (empty)
2079 question section is printed rather than real query in the answer
2081 Some believe that inverse queries are themselves a bug and
2082 prefer to fix the program generating them rather than \fItcpdump\fP.
2084 A packet trace that crosses a daylight savings time change will give
2085 skewed time stamps (the time change is ignored).
2087 Filter expressions on fields other than those in Token Ring headers will
2088 not correctly handle source-routed Token Ring packets.
2090 Filter expressions on fields other than those in 802.11 headers will not
2091 correctly handle 802.11 data packets with both To DS and From DS set.
2094 should chase header chain, but at this moment it does not.
2095 .BR "ip6 protochain"
2096 is supplied for this behavior.
2098 Arithmetic expression against transport layer headers, like \fBtcp[0]\fP,
2099 does not work against IPv6 packets.
2100 It only looks at IPv4 packets.