⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcpdump.1

📁 Windump3.6.2源代码
💻 1
📖 第 1 页 / 共 4 页
字号:
.nf\fBether host \fIehost \fBand not host \fIhost\fR.fi.in -.5iwhich can be used with either names or numbers for \fIhost / ehost\fP.)This syntax does not work in IPv6-enabled configuration at this moment..IP "\fBdst net \fInet\fR"True if the IPv4/v6 destination address of the packet has a networknumber of \fInet\fP. \fINet\fP may be either a name from /etc/networksor a network number (see \fInetworks(4)\fP for details)..IP "\fBsrc net \fInet\fR"True if the IPv4/v6 source address of the packet has a networknumber of \fInet\fP..IP "\fBnet \fInet\fR"True if either the IPv4/v6 source or destination address of the packet has a networknumber of \fInet\fP..IP "\fBnet \fInet\fR \fBmask \fImask\fR"True if the IP address matches \fInet\fR with the specific netmask.May be qualified with \fBsrc\fR or \fBdst\fR.Note that this syntax is not valid for IPv6 \fInet\fR..IP "\fBnet \fInet\fR/\fIlen\fR"True if the IPv4/v6 address matches \fInet\fR a netmask \fIlen\fR bits wide.May be qualified with \fBsrc\fR or \fBdst\fR..IP "\fBdst port \fIport\fR"True if the packet is ip/tcp, ip/udp, ip6/tcp or ip6/udp and has adestination port value of \fIport\fP.The \fIport\fP can be a number or a name used in /etc/services (see.IR tcp (4P)and.IR udp (4P)).If a name is used, both the portnumber and protocol are checked.  If a number or ambiguous name is used,only the port number is checked (e.g., \fBdst port 513\fR will print bothtcp/login traffic and udp/who traffic, and \fBport domain\fR will printboth tcp/domain and udp/domain traffic)..IP "\fBsrc port \fIport\fR"True if the packet has a source port value of \fIport\fP..IP "\fBport \fIport\fR"True if either the source or destination port of the packet is \fIport\fP.Any of the above port expressions can be prepended with the keywords,\fBtcp\fP or \fBudp\fP, as in:.in +.5i.nf\fBtcp src port \fIport\fR.fi.in -.5iwhich matches only tcp packets whose source port is \fIport\fP..IP "\fBless \fIlength\fR"True if the packet has a length less than or equal to \fIlength\fP.This is equivalent to:.in +.5i.nf\fBlen <= \fIlength\fP..fi.in -.5i.IP "\fBgreater \fIlength\fR"True if the packet has a length greater than or equal to \fIlength\fP.This is equivalent to:.in +.5i.nf\fBlen >= \fIlength\fP..fi.in -.5i.IP "\fBip proto \fIprotocol\fR"True if the packet is an IP packet (see.IR ip (4P))of protocol type \fIprotocol\fP.\fIProtocol\fP can be a number or one of the names\fIicmp\fP, \fIicmp6\fP, \fIigmp\fP, \fIigrp\fP, \fIpim\fP, \fIah\fP,\fIesp\fP, \fIudp\fP, or \fItcp\fP.Note that the identifiers \fItcp\fP, \fIudp\fP, and \fIicmp\fP are alsokeywords and must be escaped via backslash (\\), which is \\\\ in the C-shell.Note that this primitive does not chase protocol header chain..IP "\fBip6 proto \fIprotocol\fR"True if the packet is an IPv6 packet of protocol type \fIprotocol\fP.Note that this primitive does not chase protocol header chain..IP "\fBip6 protochain \fIprotocol\fR"True if the packet is IPv6 packet,and contains protocol header with type \fIprotocol\fRin its protocol header chain.For example,.in +.5i.nf\fBip6 protochain 6\fR.fi.in -.5imatches any IPv6 packet with TCP protocol header in the protocol header chain.The packet may contain, for example,authentication header, routing header, or hop-by-hop option header,between IPv6 header and TCP header.The BPF code emitted by this primitive is complex andcannot be optimized by BPF optimizer code in \fItcpdump\fP,so this can be somewhat slow..IP "\fBip protochain \fIprotocol\fR"Equivalent to \fBip6 protochain \fIprotocol\fR, but this is for IPv4..IP "\fBether broadcast\fR"True if the packet is an ethernet broadcast packet.  The \fIether\fPkeyword is optional..IP "\fBip broadcast\fR"True if the packet is an IP broadcast packet.  It checks for boththe all-zeroes and all-ones broadcast conventions, and looks upthe local subnet mask..IP "\fBether multicast\fR"True if the packet is an ethernet multicast packet.  The \fIether\fPkeyword is optional.This is shorthand for `\fBether[0] & 1 != 0\fP'..IP "\fBip multicast\fR"True if the packet is an IP multicast packet..IP "\fBip6 multicast\fR"True if the packet is an IPv6 multicast packet..IP  "\fBether proto \fIprotocol\fR"True if the packet is of ether type \fIprotocol\fR.\fIProtocol\fP can be a number or one of the names\fIip\fP, \fIip6\fP, \fIarp\fP, \fIrarp\fP, \fIatalk\fP, \fIaarp\fP,\fIdecnet\fP, \fIsca\fP, \fIlat\fP, \fImopdl\fP, \fImoprc\fP, or\fIiso\fP.Note these identifiers are also keywordsand must be escaped via backslash (\\).[In the case of FDDI (e.g., `\fBfddi protocol arp\fR'), theprotocol identification comes from the 802.2 Logical Link Control(LLC) header, which is usually layered on top of the FDDI header.\fITcpdump\fP assumes, when filtering on the protocol identifier,that all FDDI packets include an LLC header, and that the LLC headeris in so-called SNAP format.  The same applies to Token Ring.].IP "\fBdecnet src \fIhost\fR"True if the DECNET source address is.IR host ,which may be an address of the form ``10.123'', or a DECNET hostname.  [DECNET host name support is only available on Ultrix systemsthat are configured to run DECNET.].IP "\fBdecnet dst \fIhost\fR"True if the DECNET destination address is.IR host ..IP "\fBdecnet host \fIhost\fR"True if either the DECNET source or destination address is.IR host ..IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR"Abbreviations for:.in +.5i.nf\fBether proto \fIp\fR.fi.in -.5iwhere \fIp\fR is one of the above protocols..IP "\fBlat\fR, \fBmoprc\fR, \fBmopdl\fR"Abbreviations for:.in +.5i.nf\fBether proto \fIp\fR.fi.in -.5iwhere \fIp\fR is one of the above protocols.Note that\fItcpdump\fP does not currently know how to parse these protocols..IP "\fBvlan \fI[vlan_id]\fR"True if the packet is an IEEE 802.1Q VLAN packet.If \fI[vlan_id]\fR is specified, only true is the packet has the specified\fIvlan_id\fR.Note that the first \fBvlan\fR keyword encountered in \fIexpression\fRchanges the decoding offsets for the remainder of \fIexpression\fRon the assumption that the packet is a VLAN packet..IP  "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"Abbreviations for:.in +.5i.nf\fBip proto \fIp\fR\fB or ip6 proto \fIp\fR.fi.in -.5iwhere \fIp\fR is one of the above protocols..IP "\fBiso proto \fIprotocol\fR"True if the packet is an OSI packet of protocol type \fIprotocol\fP.\fIProtocol\fP can be a number or one of the names\fIclnp\fP, \fIesis\fP, or \fIisis\fP..IP "\fBclnp\fR, \fBesis\fR, \fBisis\fR"Abbreviations for:.in +.5i.nf\fBiso proto \fIp\fR.fi.in -.5iwhere \fIp\fR is one of the above protocols.Note that \fItcpdump\fR does an incomplete job of parsing these protocols..IP  "\fIexpr relop expr\fR"True if the relation holds, where \fIrelop\fR is one of >, <, >=, <=, =, !=,and \fIexpr\fR is an arithmetic expression composed of integer constants(expressed in standard C syntax), the normal binary operators[+, -, *, /, &, |], a length operator, and special packet data accessors.To accessdata inside the packet, use the following syntax:.in +.5i.nf\fIproto\fB [ \fIexpr\fB : \fIsize\fB ]\fR.fi.in -.5i\fIProto\fR is one of \fBether, fddi, tr,ip, arp, rarp, tcp, udp, icmp\fR or \fBip6\fR, andindicates the protocol layer for the index operation.Note that \fItcp, udp\fR and other upper-layer protocol types onlyapply to IPv4, not IPv6 (this will be fixed in the future).The byte offset, relative to the indicated protocol layer, isgiven by \fIexpr\fR.\fISize\fR is optional and indicates the number of bytes in thefield of interest; it can be either one, two, or four, and defaults to one.The length operator, indicated by the keyword \fBlen\fP, gives thelength of the packet.For example, `\fBether[0] & 1 != 0\fP' catches all multicast traffic.The expression `\fBip[0] & 0xf != 5\fP'catches all IP packets with options. The expression`\fBip[6:2] & 0x1fff = 0\fP'catches only unfragmented datagrams and frag zero of fragmented datagrams.This check is implicitly applied to the \fBtcp\fP and \fBudp\fPindex operations.For instance, \fBtcp[0]\fP always means the firstbyte of the TCP \fIheader\fP, and never means the first byte of anintervening fragment..LPPrimitives may be combined using:.IPA parenthesized group of primitives and operators(parentheses are special to the Shell and must be escaped)..IPNegation (`\fB!\fP' or `\fBnot\fP')..IPConcatenation (`\fB&&\fP' or `\fBand\fP')..IPAlternation (`\fB||\fP' or `\fBor\fP')..LPNegation has highest precedence.Alternation and concatenation have equal precedence and associateleft to right.  Note that explicit \fBand\fR tokens, not juxtaposition,are now required for concatenation..LPIf an identifier is given without a keyword, the most recent keywordis assumed.For example,.in +.5i.nf\fBnot host vs and ace\fR.fi.in -.5iis short for.in +.5i.nf\fBnot host vs and host ace\fR.fi.in -.5iwhich should not be confused with.in +.5i.nf\fBnot ( host vs or ace )\fR.fi.in -.5i.LPExpression arguments can be passed to \fItcpdump\fP as either a singleargument or as multiple arguments, whichever is more convenient.Generally, if the expression contains Shell metacharacters, it iseasier to pass it as a single, quoted argument.Multiple arguments are concatenated with spaces before being parsed..SH EXAMPLES.LPTo print all packets arriving at or departing from \fIsundown\fP:.RS.nf\fBtcpdump host sundown\fP.fi.RE.LPTo print traffic between \fIhelios\fR and either \fIhot\fR or \fIace\fR:.RS.nf\fBtcpdump host helios and \\( hot or ace \\)\fP.fi.RE.LPTo print all IP packets between \fIace\fR and any host except \fIhelios\fR:.RS.nf\fBtcpdump ip host ace and not helios\fP.fi.RE.LPTo print all traffic between local hosts and hosts at Berkeley:.RS.nf.Btcpdump net ucb-ether.fi.RE.LPTo print all ftp traffic through internet gateway \fIsnup\fP:(note that the expression is quoted to prevent the shell from(mis-)interpreting the parentheses):.RS.nf.Btcpdump 'gateway snup and (port ftp or ftp-data)'.fi.RE.LPTo print traffic neither sourced from nor destined for local hosts(if you gateway to one other net, this stuff should never make itonto your local net)..RS.nf.Btcpdump ip and not net \fIlocalnet\fP.fi.RE.LPTo print the start and end packets (the SYN and FIN packets) of eachTCP conversation that involves a non-local host..RS.nf.Btcpdump 'tcp[13] & 3 != 0 and not src and dst net \fIlocalnet\fP'.fi.RE.LPTo print IP packets longer than 576 bytes sent through gateway \fIsnup\fP:.RS.nf.Btcpdump 'gateway snup and ip[2:2] > 576'.fi.RE.LPTo print IP broadcast or multicast packets that were.I notsent via ethernet broadcast or multicast:.RS.nf.Btcpdump 'ether[0] & 1 = 0 and ip[16] >= 224'.fi.RE.LPTo print all ICMP packets that are not echo requests/replies (i.e., notping packets):.RS.nf.Btcpdump 'icmp[0] != 8 and icmp[0] != 0'.fi.RE.SH OUTPUT FORMAT.LPThe output of \fItcpdump\fP is protocol dependent.  The followinggives a brief description and examples of most of the formats..de HD.sp 1.5.B...HDLink Level Headers.LPIf the '-e' option is given, the link level header is printed out.On ethernets, the source and destination addresses, protocol,and packet length are printed..LPOn FDDI networks, the  '-e' option causes \fItcpdump\fP to printthe `frame control' field,  the source and destination addresses,and the packet length.  (The `frame control' field governs theinterpretation of the rest of the packet.  Normal packets (suchas those containing IP datagrams) are `async' packets, with a priorityvalue between 0 and 7; for example, `\fBasync4\fR'.  Such packetsare assumed to contain an 802.2 Logical Link Control (LLC) packet;the LLC header is printed if it is \fInot\fR an ISO datagram or aso-called SNAP packet..LPOn Token Ring networks, the '-e' option causes \fItcpdump\fP to printthe `access control' and `frame control' fields, the source anddestination addresses, and the packet length.  As on FDDI networks,packets are assumed to contain an LLC packet.  Regardless of whetherthe '-e' option is specified or not, the source routing information isprinted for source-routed packets..LP\fI(N.B.: The following description assumes familiarity withthe SLIP compression algorithm described in RFC-1144.)\fP.LPOn SLIP links, a direction indicator (``I'' for inbound, ``O'' for outbound),packet type, and compression information are printed out.The packet type is printed first.The three types are \fIip\fP, \fIutcp\fP, and \fIctcp\fP.No further link information is printed for \fIip\fR packets.For TCP packets, the connection identifier is printed following the type.If the packet is compressed, its encoded header is printed out.The special cases are printed out as\fB*S+\fIn\fR and \fB*SA+\fIn\fR, where \fIn\fR is the amount by whichthe sequence number (or sequence number and ack) has changed.If it is not a special case,zero or more changes are printed.A change is indicated by U (urgent pointer), W (window), A (ack),S (sequence number), and I (packet ID), followed by a delta (+n or -n),or a new value (=n).Finally, the amount of data in the packet and compressed header lengthare printed..LPFor example, the following line shows an outbound compressed TCP packet,with an implicit connection identifier; the ack has changed by 6,the sequence number by 49, and the packet ID by 6; there are 3 bytes ofdata and 6 bytes of compressed header:.RS.nf\fBO ctcp * A+6 S+49 I+6 3 (6)\fP.fi.RE.HDARP/RARP Packets.LPArp/rarp output shows the type of request and its arguments.  Theformat is intended to be self explanatory.Here is a short sample taken from the start of an `rlogin' fromhost \fIrtsg\fP to host \fIcsam\fP:.RS.nf.sp .5

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -