📄 tcpdump.1
字号:
On the 7th line, csam says it's received data sent by rtsg up tobut not including byte 21. Most of this data is apparently sitting in thesocket buffer since csam's receive window has gotten 19 bytes smaller.Csam also sends one byte of data to rtsg in this packet.On the 8th and 9th lines,csam sends two bytes of urgent, pushed data to rtsg..LPIf the snapshot was small enough that \fBtcpdump\fP didn't capturethe full TCP header, it interprets as much of the header as it canand then reports ``[|\fItcp\fP]'' to indicate the remainder could notbe interpreted. If the header contains a bogus option (one with a lengththat's either too small or beyond the end of the header), tcpdump reportsit as ``[\fIbad opt\fP]'' and does not interpret any further options (sinceit's impossible to tell where they start). If the header length indicatesoptions are present but the IP datagram length is not long enough for theoptions to actually be there, tcpdump reports it as ``[\fIbad hdr length\fP]''..HD.BUDP Packets.LPUDP format is illustrated by this rwho packet:.RS.nf.sp .5\f(CWactinide.who > broadcast.who: udp 84\fP.sp .5.fi.REThis says that port \fIwho\fP on host \fIactinide\fP sent a udpdatagram to port \fIwho\fP on host \fIbroadcast\fP, the Internetbroadcast address. The packet contained 84 bytes of user data..LPSome UDP services are recognized (from the source or destinationport number) and the higher level protocol information printed.In particular, Domain Name service requests (RFC-1034/1035) and SunRPC calls (RFC-1050) to NFS..HDUDP Name Server Requests.LP\fI(N.B.:The following description assumes familiarity withthe Domain Service protocol described in RFC-1035. If you are not familiarwith the protocol, the following description will appear to be writtenin greek.)\fP.LPName server requests are formatted as.RS.nf.sp .5\fIsrc > dst: id op? flags qtype qclass name (len)\fP.sp .5\f(CWh2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37)\fP.sp .5.fi.REHost \fIh2opolo\fP asked the domain server on \fIhelios\fP for anaddress record (qtype=A) associated with the name \fIucbvax.berkeley.edu.\fPThe query id was `3'. The `+' indicates the \fIrecursion desired\fP flagwas set. The query length was 37 bytes, not including the UDP andIP protocol headers. The query operation was the normal one, \fIQuery\fP,so the op field was omitted. If the op had been anything else, it wouldhave been printed between the `3' and the `+'.Similarly, the qclass was the normal one,\fIC_IN\fP, and omitted. Any other qclass would have been printedimmediately after the `A'..LPA few anomalies are checked and may result in extra fields enclosed insquare brackets: If a query contains an answer, name server orauthority section,.IR ancount ,.IR nscount ,or.I arcountare printed as `[\fIn\fPa]', `[\fIn\fPn]' or `[\fIn\fPau]' where \fIn\fPis the appropriate count.If any of the response bits are set (AA, RA or rcode) or any of the`must be zero' bits are set in bytes two and three, `[b2&3=\fIx\fP]'is printed, where \fIx\fP is the hex value of header bytes two and three..HDUDP Name Server Responses.LPName server responses are formatted as.RS.nf.sp .5\fIsrc > dst: id op rcode flags a/n/au type class data (len)\fP.sp .5\f(CWhelios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273)helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97)\fP.sp .5.fi.REIn the first example, \fIhelios\fP responds to query id 3 from \fIh2opolo\fPwith 3 answer records, 3 name server records and 7 authority records.The first answer record is type A (address) and its data is internetaddress 128.32.137.3. The total size of the response was 273 bytes,excluding UDP and IP headers. The op (Query) and response code(NoError) were omitted, as was the class (C_IN) of the A record..LPIn the second example, \fIhelios\fP responds to query 2 with aresponse code of non-existent domain (NXDomain) with no answers,one name server and no authority records. The `*' indicates thatthe \fIauthoritative answer\fP bit was set. Since there were noanswers, no type, class or data were printed..LPOther flag characters that might appear are `\-' (recursion available,RA, \fInot\fP set) and `|' (truncated message, TC, set). If the`question' section doesn't contain exactly one entry, `[\fIn\fPq]'is printed..LPNote that name server requests and responses tend to be large and thedefault \fIsnaplen\fP of 68 bytes may not capture enough of the packetto print. Use the \fB\-s\fP flag to increase the snaplen if youneed to seriously investigate name server traffic. `\fB\-s 128\fP'has worked well for me..HDNFS Requests and Replies.LPSun NFS (Network File System) requests and replies are printed as:.RS.nf.sp .5\fIsrc.xid > dst.nfs: len op args\fP\fIsrc.nfs > dst.xid: reply stat len op results\fP.sp .5\f(CWsushi.6709 > wrl.nfs: 112 readlink fh 21,24/10.73165wrl.nfs > sushi.6709: reply ok 40 readlink "../var"sushi.201b > wrl.nfs: 144 lookup fh 9,74/4096.6878 "xcolors"wrl.nfs > sushi.201b: reply ok 128 lookup fh 9,74/4134.3150\fP.sp .5.fi.REIn the first line, host \fIsushi\fP sends a transaction with id \fI6709\fPto \fIwrl\fP (note that the number following the src host is atransaction id, \fInot\fP the source port). The request was 112 bytes,excluding the UDP and IP headers. The operation was a \fIreadlink\fP(read symbolic link) on file handle (\fIfh\fP) 21,24/10.731657119.(If one is lucky, as in this case, the file handle can be interpretedas a major,minor device number pair, followed by the inode number andgeneration number.)\fIWrl\fP replies `ok' with the contents of the link..LPIn the third line, \fIsushi\fP asks \fIwrl\fP to lookup the name`\fIxcolors\fP' in directory file 9,74/4096.6878. Note that the data printeddepends on the operation type. The format is intended to be selfexplanatory if read in conjunction withan NFS protocol spec..LPIf the \-v (verbose) flag is given, additional information is printed.For example:.RS.nf.sp .5\f(CWsushi.1372a > wrl.nfs: 148 read fh 21,11/12.195 8192 bytes @ 24576wrl.nfs > sushi.1372a: reply ok 1472 read REG 100664 ids 417/0 sz 29388\fP.sp .5.fi.RE(\-v also prints the IP header TTL, ID, and fragmentation fields,which have been omitted from this example.) In the first line,\fIsushi\fP asks \fIwrl\fP to read 8192 bytes from file 21,11/12.195,at byte offset 24576. \fIWrl\fP replies `ok'; the packet shown on thesecond line is the first fragment of the reply, and hence is only 1472bytes long (the other bytes will follow in subsequent fragments, butthese fragments do not have NFS or even UDP headers and so might not beprinted, depending on the filter expression used). Because the \-v flagis given, some of the file attributes (which are returned in additionto the file data) are printed: the file type (``REG'', for regular file),the file mode (in octal), the uid and gid, and the file size..LPIf the \-v flag is given more than once, even more details are printed..LPNote that NFS requests are very large and much of the detail won't be printedunless \fIsnaplen\fP is increased. Try using `\fB\-s 192\fP' to watchNFS traffic..LPNFS reply packets do not explicitly identify the RPC operation. Instead,\fItcpdump\fP keeps track of ``recent'' requests, and matches them to thereplies using the transaction ID. If a reply does not closely follow thecorresponding request, it might not be parsable..HDKIP Appletalk (DDP in UDP).LPAppletalk DDP packets encapsulated in UDP datagrams are de-encapsulatedand dumped as DDP packets (i.e., all the UDP header information isdiscarded). The file.I /etc/atalk.namesis used to translate appletalk net and node numbers to names.Lines in this file have the form.RS.nf.sp .5\fInumber name\fP\f(CW1.254 ether16.1 icsd-net1.254.110 ace\fP.sp .5.fi.REThe first two lines give the names of appletalk networks. The thirdline gives the name of a particular host (a host is distinguishedfrom a net by the 3rd octet in the number \-a net number \fImust\fP have two octets and a host number \fImust\fPhave three octets.) The number and name should be separated bywhitespace (blanks or tabs).The.I /etc/atalk.namesfile may contain blank lines or comment lines (lines starting witha `#')..LPAppletalk addresses are printed in the form.RS.nf.sp .5\fInet.host.port\fP\f(CW144.1.209.2 > icsd-net.112.220office.2 > icsd-net.112.220jssmag.149.235 > icsd-net.2\fP.sp .5.fi.RE(If the.I /etc/atalk.namesdoesn't exist or doesn't contain an entry for some appletalkhost/net number, addresses are printed in numeric form.)In the first example, NBP (DDP port 2) on net 144.1 node 209is sending to whatever is listening on port 220 of net icsd node 112.The second line is the same except the full name of the source nodeis known (`office'). The third line is a send from port 235 onnet jssmag node 149 to broadcast on the icsd-net NBP port (note thatthe broadcast address (255) is indicated by a net name with no hostnumber \- for this reason it's a good idea to keep node names andnet names distinct in /etc/atalk.names)..LPNBP (name binding protocol) and ATP (Appletalk transaction protocol)packets have their contents interpreted. Other protocols just dumpthe protocol name (or number if no name is registered for theprotocol) and packet size.\fBNBP packets\fP are formatted like the following examples:.RS.nf.sp .5\s-2\f(CWicsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*"jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186\fP\s+2.sp .5.fi.REThe first line is a name lookup request for laserwriters sent by net icsd host112 and broadcast on net jssmag. The nbp id for the lookup is 190.The second line shows a reply for this request (note that it has thesame id) from host jssmag.209 saying that it has a laserwriterresource named "RM1140" registered on port 250. The third line isanother reply to the same request saying host techpit has laserwriter"techpit" registered on port 186.\fBATP packet\fP formatting is demonstrated by the following example:.RS.nf.sp .5\s-2\f(CWjssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002\fP\s+2.sp .5.fi.REJssmag.209 initiates transaction id 12266 with host helios by requestingup to 8 packets (the `<0-7>'). The hex number at the end of the lineis the value of the `userdata' field in the request..LPHelios responds with 8 512-byte packets. The `:digit' following thetransaction id gives the packet sequence number in the transactionand the number in parens is the amount of data in the packet,excluding the atp header. The `*' on packet 7 indicates that theEOM bit was set..LPJssmag.209 then requests that packets 3 & 5 be retransmitted. Heliosresends them then jssmag.209 releases the transaction. Finally,jssmag.209 initiates the next request. The `*' on the requestindicates that XO (`exactly once') was \fInot\fP set..HDIP Fragmentation.LPFragmented Internet datagrams are printed as.RS.nf.sp .5\fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB+)\fR\fB(frag \fIid\fB:\fIsize\fB@\fIoffset\fB)\fR.sp .5.fi.RE(The first form indicates there are more fragments. The secondindicates this is the last fragment.).LP\fIId\fP is the fragment id. \fISize\fP is the fragmentsize (in bytes) excluding the IP header. \fIOffset\fP is thisfragment's offset (in bytes) in the original datagram..LPThe fragment information is output for each fragment. The firstfragment contains the higher level protocol header and the fraginfo is printed after the protocol info. Fragmentsafter the first contain no higher level protocol header and thefrag info is printed after the source and destination addresses.For example, here is part of an ftp from arizona.edu to lbl-rtsg.arpaover a CSNET connection that doesn't appear to handle 576 byte datagrams:.RS.nf.sp .5\s-2\f(CWarizona.ftp-data > rtsg.1170: . 1024:1332(308) ack 1 win 4096 (frag 595a:328@0+)arizona > rtsg: (frag 595a:204@328)rtsg.1170 > arizona.ftp-data: . ack 1536 win 2560\fP\s+2.sp .5.fi.REThere are a couple of things to note here: First, addresses in the2nd line don't include port numbers. This is because the TCPprotocol information is all in the first fragment and we have no ideawhat the port or sequence numbers are when we print the later fragments.Second, the tcp sequence information in the first line is printed as if therewere 308 bytes of user data when, in fact, there are 512 bytes (308 inthe first frag and 204 in the second). If you are looking for holesin the sequence space or trying to match up ackswith packets, this can fool you..LPA packet with the IP \fIdon't fragment\fP flag is marked with atrailing \fB(DF)\fP..HDTimestamps.LPBy default, all output lines are preceded by a timestamp. The timestampis the current clock time in the form.RS.nf\fIhh:mm:ss.frac\fP.fi.REand is as accurate as the kernel's clock.The timestamp reflects the time the kernel first saw the packet. No attemptis made to account for the time lag between when theethernet interface removed the packet from the wire and when the kernelserviced the `new packet' interrupt..SH "SEE ALSO"traffic(1C), nit(4P), bpf(4), pcap(3).SH AUTHORSVan Jacobson,Craig Leres andSteven McCanne, all of theLawrence Berkeley National Laboratory, University of California, Berkeley, CA..LPThe current version is available via anonymous ftp:.LP.RS.I ftp://ftp.ee.lbl.gov/tcpdump.tar.Z.RE.SH BUGSPlease send bug reports to tcpdump@ee.lbl.gov..LPNIT doesn't let you watch your own outbound traffic, BPF will.We recommend that you use the latter..LPSome attempt should be made to reassemble IP fragments or, at leastto compute the right length for the higher level protocol..LPName server inverse queries are not dumped correctly: The (empty)question section is printed rather than real query in the answersection. Some believe that inverse queries are themselves a bug andprefer to fix the program generating them rather than tcpdump..LPApple Ethertalk DDP packets could be dumped as easily as KIP DDPpackets but aren't.Even if we were inclined to do anything to promote the use ofEthertalk (we aren't), LBL doesn't allow Ethertalk on any of itsnetworks so we'd would have no way of testing this code..LPA packet trace that crosses a daylight savings time change will giveskewed time stamps (the time change is ignored)..LPFilters expressions that manipulate FDDI headers assume that all FDDIpackets are encapsulated Ethernet packets. This is true for IP, ARP,and DECNET Phase IV, but is not true for protocols such as ISO CLNS.Therefore, the filter may inadvertently accept certain packets thatdo not properly match the filter expression.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -