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

📄 tcpdump.1

📁 网卡驱动相关实例 这是和网卡NT KMD驱动程序有关的一些资料和例子。主要是以下三方面内容: 3.1 article 一些有用的文档 3.2 Canberra 网络诊听工具Ethern
💻 1
📖 第 1 页 / 共 3 页
字号:
.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, \fIigrp\fP, \fIudp\fP, \fInd\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..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  "\fBether proto \fIprotocol\fR"True if the packet is of ether type \fIprotocol\fR.\fIProtocol\fP can be a number or a name like\fIip\fP, \fIarp\fP, or \fIrarp\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.].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, \fBarp\fR, \fBrarp\fR, \fBdecnet\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  "\fBtcp\fR, \fBudp\fR, \fBicmp\fR"Abbreviations for:.in +.5i.nf\fBip proto \fIp\fR.fi.in -.5iwhere \fIp\fR is one of the above 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,ip, arp, rarp, tcp, udp, \fRor \fBicmp\fR, andindicates the protocol layer for the index operation.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 tcpdump as either a single argumentor 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..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\f(CWarp who-has csam tell rtsgarp reply csam is-at CSAM\fP.sp .5.fi.REThe first line says that rtsg sent an arp packet askingfor the ethernet address of internet host csam.  Csamreplies with its ethernet address (in this example, ethernet addressesare in caps and internet addresses in lower case)..LPThis would look less redundant if we had done \fBtcpdump \-n\fP:.RS.nf.sp .5\f(CWarp who-has 128.3.254.6 tell 128.3.254.68arp reply 128.3.254.6 is-at 02:07:01:00:01:c4\fP.fi.RE.LPIf we had done \fBtcpdump \-e\fP, the fact that the first packet isbroadcast and the second is point-to-point would be visible:.RS.nf.sp .5\f(CWRTSG Broadcast 0806  64: arp who-has csam tell rtsgCSAM RTSG 0806  64: arp reply csam is-at CSAM\fP.sp .5.fi.REFor the first packet this says the ethernet source address is RTSG, thedestination is the ethernet broadcast address, the type fieldcontained hex 0806 (type ETHER_ARP) and the total length was 64 bytes..HDTCP Packets.LP\fI(N.B.:The following description assumes familiarity withthe TCP protocol described in RFC-793.  If you are not familiarwith the protocol, neither this description nor tcpdump willbe of much use to you.)\fP.LPThe general format of a tcp protocol line is:.RS.nf.sp .5\fIsrc > dst: flags data-seqno ack window urgent options\fP.sp .5.fi.RE\fISrc\fP and \fIdst\fP are the source and destination IPaddresses and ports.  \fIFlags\fP are some combination of S (SYN),F (FIN), P (PUSH) or R (RST) or a single `.' (no flags).\fIData-seqno\fP describes the portion of sequence space coveredby the data in this packet (see example below).\fIAck\fP is sequence number of the next data expected the otherdirection on this connection.\fIWindow\fP is the number of bytes of receive buffer space availablethe other direction on this connection.\fIUrg\fP indicates there is `urgent' data in the packet.\fIOptions\fP are tcp options enclosed in angle brackets (e.g., <mss 1024>)..LP\fISrc, dst\fP and \fIflags\fP are always present.  The other fieldsdepend on the contents of the packet's tcp protocol header andare output only if appropriate..LPHere is the opening portion of an rlogin from host \fIrtsg\fP tohost \fIcsam\fP..RS.nf.sp .5\s-2\f(CWrtsg.1023 > csam.login: S 768512:768512(0) win 4096 <mss 1024>csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 <mss 1024>rtsg.1023 > csam.login: . ack 1 win 4096rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096csam.login > rtsg.1023: . ack 2 win 4096rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1\fP\s+2.sp .5.fi.REThe first line says that tcp port 1023 on rtsg sent a packetto port \fIlogin\fPon csam.  The \fBS\fP indicates that the \fISYN\fP flag was set.The packet sequence number was 768512 and it contained no data.(The notation is `first:last(nbytes)' which means `sequencenumbers \fIfirst\fPup to but not including \fIlast\fP which is \fInbytes\fP bytes of user data'.)There was no piggy-backed ack, the available receive window was 4096bytes and there was a max-segment-size option requesting an mss of1024 bytes..LPCsam replies with a similar packet except it includes a piggy-backedack for rtsg's SYN.  Rtsg then acks csam's SYN.  The `.' means noflags were set.The packet contained no data so there is no data sequence number.Note that the ack sequencenumber is a small integer (1).  The first time \fBtcpdump\fP sees atcp `conversation', it prints the sequence number from the packet.On subsequent packets of the conversation, the difference betweenthe current packet's sequence number and this initial sequence numberis printed.  This means that sequence numbers after thefirst can be interpretedas relative byte positions in the conversation's data stream (with thefirst data byte each direction being `1').  `-S' will override thisfeature, causing the original sequence numbers to be output..LPOn the 6th line, rtsg sends csam 19 bytes of data (bytes 2 through 20in the rtsg \(-> csam side of the conversation).The PUSH flag is set in the packet.

⌨️ 快捷键说明

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