📄 tcpdump.1
字号:
.\" @(#) $Header: /tcpdump/master/tcpdump/tcpdump.1,v 1.92.2.2 2001/01/18 04:38:31 guy Exp $ (LBL).\".\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996, 1997.\" The Regents of the University of California. All rights reserved..\" All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that: (1) source code distributions.\" retain the above copyright notice and this paragraph in its entirety, (2).\" distributions including binary code include the above copyright notice and.\" this paragraph in its entirety in the documentation or other materials.\" provided with the distribution, and (3) all advertising materials mentioning.\" features or use of this software display the following acknowledgement:.\" ``This product includes software developed by the University of California,.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of.\" the University nor the names of its contributors may be used to endorse.\" or promote products derived from this software without specific prior.\" written permission..\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE..\".TH TCPDUMP 1 "3 January 2001".SH NAMEtcpdump \- dump traffic on a network.SH SYNOPSIS.na.B tcpdump[.B \-adeflnNOpqRStvxX] [.B \-c.I count] [.B \-F.I file].br.ti +8[.B \-i.I interface][.B \-m.I module][.B \-r.I file].br.ti +8[.B \-s.I snaplen][.B \-T.I type][.B \-w.I file].br.ti +8[.B \-E.I algo:secret][.I expression].br.ad.SH DESCRIPTION.LP\fITcpdump\fP prints out the headers of packets on a network interfacethat match the boolean \fIexpression\fP..LP.B Under SunOS with nit or bpf:To run.I tcpdumpyou must have read access to.I /dev/nitor.IR /dev/bpf* ..B Under Solaris with dlpi:You must have read/write access to the network pseudo device, e.g..IR /dev/le ..B Under HP-UX with dlpi:You must be root or it must be installed setuid to root..B Under IRIX with snoop:You must be root or it must be installed setuid to root..B Under Linux:You must be root or it must be installed setuid to root..B Under Ultrix and Digital UNIX:Once the super-user has enabled promiscuous-mode operation using.IR pfconfig (8),any user may run.BR tcpdump ..B Under BSD:You must have read access to.IR /dev/bpf* ..SH OPTIONS.TP.B \-aAttempt to convert network and broadcast addresses to names..TP.B \-cExit after receiving \fIcount\fP packets..TP.B \-dDump the compiled packet-matching code in a human readable form tostandard output and stop..TP.B \-ddDump packet-matching code as a.B Cprogram fragment..TP.B \-dddDump packet-matching code as decimal numbers (preceded with a count)..TP.B \-ePrint the link-level header on each dump line..TP.B \-EUse \fIalgo:secret\fP for decrypting IPsec ESP packets. Algorithms may be \fBdes-cbc\fP, \fB3des-cbc\fP, \fBblowfish-cbc\fP, \fBrc3-cbc\fP, \fBcast128-cbc\fP, or \fBnone\fP.The default is \fBdes-cbc\fP.The ability to decrypt packets is only present if \fItcpdump\fP was compiledwith cryptography enabled.\fIsecret\fP the ascii text for ESP secret key.We cannot take arbitrary binary value at this moment.The option assumes RFC2406 ESP, not RFC1827 ESP.The option is only for debugging purposes, andthe use of this option with truly `secret' key is discouraged.By presenting IPsec secret key onto command lineyou make it visible to others, via.IR ps (1)and other occasions..TP.B \-fPrint `foreign' internet addresses numerically rather than symbolically(this option is intended to get around serious brain damage inSun's yp server \(em usually it hangs forever translating non-localinternet numbers)..TP.B \-FUse \fIfile\fP as input for the filter expression.An additional expression given on the command line is ignored..TP.B \-iListen on \fIinterface\fP.If unspecified, \fItcpdump\fP searches the system interface list for thelowest numbered, configured up interface (excluding loopback).Ties are broken by choosing the earliest match..IPOn Linux systems with 2.2 or later kernels, an.I interfaceargument of ``any'' can be used to capture packets from all interfaces. Note that captures on the ``any'' device will not be done in promiscuousmode..TP.B \-lMake stdout line buffered. Useful if you want to see the datawhile capturing it. E.g.,.br``tcpdump\ \ \-l\ \ |\ \ tee dat'' or``tcpdump\ \ \-l \ \ > dat\ \ &\ \ tail\ \ \-f\ \ dat''..TP.B \-nDon't convert addresses (i.e., host addresses, port numbers, etc.) to names..TP.B \-NDon't print domain name qualification of host names. E.g.,if you give this flag then \fItcpdump\fP will print ``nic''instead of ``nic.ddn.mil''..TP.B \-mLoad SMI MIB module definitions from file \fImodule\fR. This option can be used several times to load several MIB modules into \fItcpdump\fP..TP.B \-ODo not run the packet-matching code optimizer. This is useful onlyif you suspect a bug in the optimizer..TP.B \-p\fIDon't\fP put the interfaceinto promiscuous mode. Note that the interface might be in promiscuousmode for some other reason; hence, `-p' cannot be used as an abbreviation for`ether host {local-hw-addr} or ether broadcast'..TP.B \-qQuick (quiet?) output. Print less protocol information so outputlines are shorter..TP.B \-rRead packets from \fIfile\fR (which was created with the -w option).Standard input is used if \fIfile\fR is ``-''..TP.B \-sSnarf \fIsnaplen\fP bytes of data from each packet rather than thedefault of 68 (with SunOS's NIT, the minimum is actually 96).68 bytes is adequate for IP, ICMP, TCPand UDP but may truncate protocol information from name server and NFSpackets (see below). Packets truncated because of a limited snapshotare indicated in the output with ``[|\fIproto\fP]'', where \fIproto\fPis the name of the protocol level at which the truncation has occurred.Note that taking larger snapshots both increasesthe amount of time it takes to process packets and, effectively,decreases the amount of packet buffering. This may cause packets to belost. You should limit \fIsnaplen\fP to the smallest number that willcapture the protocol information you're interested in. Setting\fIsnaplen\fP to 0 means use the required length to catch whole packets..TP.B \-TForce packets selected by "\fIexpression\fP" to be interpreted thespecified \fItype\fR. Currently known types are\fBcnfp\fR (Cisco NetFlow protocol),\fBrpc\fR (Remote Procedure Call),\fBrtp\fR (Real-Time Applications protocol),\fBrtcp\fR (Real-Time Applications control protocol),\fBsnmp\fR (Simple Network Management Protocol),\fBvat\fR (Visual Audio Tool),and\fBwb\fR (distributed White Board)..TP.B \-RAssume ESP/AH packets to be based on old specification (RFC1825 to RFC1829).If specified, \fItcpdump\fP will not print replay prevention field.Since there is no protocol version field in ESP/AH specification,\fItcpdump\fP cannot deduce the version of ESP/AH protocol..TP.B \-SPrint absolute, rather than relative, TCP sequence numbers..TP.B \-t\fIDon't\fP print a timestamp on each dump line..TP.B \-ttPrint an unformatted timestamp on each dump line..TP.B \-v(Slightly more) verbose output. For example, the time to live,identification, total length and options in an IP packet are printed.Also enables additional packet integrity checks such as verifying theIP and ICMP header checksum..TP.B \-vvEven more verbose output. For example, additional fields areprinted from NFS reply packets..TP.B \-vvvEven more verbose output. For example,telnet \fBSB\fP ... \fBSE\fP optionsare printed in full. With.B \-Xtelnet options are printed in hex as well..TP.B \-wWrite the raw packets to \fIfile\fR rather than parsing and printingthem out. They can later be printed with the \-r option.Standard output is used if \fIfile\fR is ``-''..TP.B \-xPrint each packet (minus its link level header) in hex.The smaller of the entire packet or.I snaplenbytes will be printed..TP.B \-XWhen printing hex, print ascii too. Thus if.B \-xis also set, the packet is printed in hex/ascii.This is very handy for analysing new protocols.Even if.B \-xis not also set, some parts of some packets may be printedin hex/ascii..IP "\fI expression\fP".RSselects which packets will be dumped. If no \fIexpression\fPis given, all packets on the net will be dumped. Otherwise,only packets for which \fIexpression\fP is `true' will be dumped..LPThe \fIexpression\fP consists of one or more.I primitives.Primitives usually consist of an.I id(name or number) preceded by one or more qualifiers. There are threedifferent kinds of qualifier:.IP \fItype\fPqualifiers say what kind of thing the id name or number refers to.Possible types are.BR host ,.B netand.BR port .E.g., `host foo', `net 128.3', `port 20'. If there is no typequalifier,.B hostis assumed..IP \fIdir\fPqualifiers specify a particular transfer direction to and/or from.IR id .Possible directions are.BR src ,.BR dst ,.B "src or dst"and.B "src and".BR dst .E.g., `src foo', `dst net 128.3', `src or dst port ftp-data'. Ifthere is no dir qualifier,.B "src or dst"is assumed.For `null' link layers (i.e. point to point protocols such as slip) the.B inboundand.B outboundqualifiers can be used to specify a desired direction..IP \fIproto\fPqualifiers restrict the match to a particular protocol. Possibleprotos are:.BR ether ,.BR fddi ,.BR tr ,.BR ip ,.BR ip6 ,.BR arp ,.BR rarp ,.BR decnet ,.B tcpand.BR udp .E.g., `ether src foo', `arp net 128.3', `tcp port 21'. If there isno proto qualifier, all protocols consistent with the type areassumed. E.g., `src foo' means `(ip or arp or rarp) src foo'(except the latter is not legal syntax), `net bar' means `(ip orarp or rarp) net bar' and `port 53' means `(tcp or udp) port 53'..LP[`fddi' is actually an alias for `ether'; the parser treats themidentically as meaning ``the data link level used on the specifiednetwork interface.'' FDDI headers contain Ethernet-like sourceand destination addresses, and often contain Ethernet-like packettypes, so you can filter on these FDDI fields just as with theanalogous Ethernet fields. FDDI headers also contain other fields,but you cannot name them explicitly in a filter expression..LPSimilarly, `tr' is an alias for `ether'; the previous paragraph'sstatements about FDDI headers also apply to Token Ring headers.].LPIn addition to the above, there are some special `primitive' keywordsthat don't follow the pattern:.BR gateway ,.BR broadcast ,.BR less ,.B greaterand arithmetic expressions. All of these are described below..LPMore complex filter expressions are built up by using the words.BR and ,.B orand.B notto combine primitives. E.g., `host foo and not port ftp and not port ftp-data'.To save typing, identical qualifier lists can be omitted. E.g.,`tcp dst port ftp or ftp-data or domain' is exactly the same as`tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain'..LPAllowable primitives are:.IP "\fBdst host \fIhost\fR"True if the IPv4/v6 destination field of the packet is \fIhost\fP,which may be either an address or a name..IP "\fBsrc host \fIhost\fR"True if the IPv4/v6 source field of the packet is \fIhost\fP..IP "\fBhost \fIhost\fPTrue if either the IPv4/v6 source or destination of the packet is \fIhost\fP.Any of the above host expressions can be prepended with the keywords,\fBip\fP, \fBarp\fP, \fBrarp\fP, or \fBip6\fP as in:.in +.5i.nf\fBip host \fIhost\fR.fi.in -.5iwhich is equivalent to:.in +.5i.nf\fBether proto \fI\\ip\fB and host \fIhost\fR.fi.in -.5iIf \fIhost\fR is a name with multiple IP addresses, each address willbe checked for a match..IP "\fBether dst \fIehost\fPTrue if the ethernet destination address is \fIehost\fP. \fIEhost\fPmay be either a name from /etc/ethers or a number (see.IR ethers (3N)for numeric format)..IP "\fBether src \fIehost\fPTrue if the ethernet source address is \fIehost\fP..IP "\fBether host \fIehost\fPTrue if either the ethernet source or destination address is \fIehost\fP..IP "\fBgateway\fP \fIhost\fPTrue if the packet used \fIhost\fP as a gateway. I.e., the ethernetsource or destination address was \fIhost\fP but neither the IP sourcenor the IP destination was \fIhost\fP. \fIHost\fP must be a name andmust be found in both /etc/hosts and /etc/ethers. (An equivalentexpression is.in +.5i
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -