1.\" $OpenBSD: tcpdump.8,v 1.76 2012/07/10 18:07:37 sthen Exp $ 2.\" 3.\" Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992, 1994, 1995, 1996 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that: (1) source code distributions 8.\" retain the above copyright notice and this paragraph in its entirety, (2) 9.\" distributions including binary code include the above copyright notice and 10.\" this paragraph in its entirety in the documentation or other materials 11.\" provided with the distribution, and (3) all advertising materials mentioning 12.\" features or use of this software display the following acknowledgement: 13.\" ``This product includes software developed by the University of California, 14.\" Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 15.\" the University nor the names of its contributors may be used to endorse 16.\" or promote products derived from this software without specific prior 17.\" written permission. 18.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 19.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 20.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 21.\" 22.Dd $Mdocdate: July 10 2012 $ 23.Dt TCPDUMP 8 24.Os 25.Sh NAME 26.Nm tcpdump 27.Nd dump traffic on a network 28.Sh SYNOPSIS 29.Nm tcpdump 30.Bk -words 31.Op Fl AadefILlNnOopqStvXx 32.Op Fl c Ar count 33.Op Fl D Ar direction 34.Oo Fl E Oo Ar espalg : Oc Ns 35.Ar espkey Oc 36.Op Fl F Ar file 37.Op Fl i Ar interface 38.Op Fl r Ar file 39.Op Fl s Ar snaplen 40.Op Fl T Ar type 41.Op Fl w Ar file 42.Op Fl y Ar datalinktype 43.Op Ar expression 44.Ek 45.Sh DESCRIPTION 46.Nm 47prints out the headers of packets on a network interface that match the boolean 48.Ar expression . 49You must have read access to 50.Pa /dev/bpf* . 51.Pp 52The options are as follows: 53.Bl -tag -width "-c count" 54.It Fl A 55Print each packet in ASCII. 56If the 57.Fl e 58option is also specified, the link-level header will be included. 59The smaller of the entire packet or 60.Ar snaplen 61bytes will be printed. 62.It Fl a 63Attempt to convert network and broadcast addresses to names. 64.It Fl c Ar count 65Exit after receiving 66.Ar count 67packets. 68.It Fl D Ar direction 69Select packets flowing in the specified 70.Ar direction . 71Valid directions are: 72.Cm in 73and 74.Cm out . 75The default is to accept packets flowing in any direction. 76.It Fl d 77Dump the compiled packet-matching code in a human readable form to 78standard output and stop. 79.It Fl dd 80Dump packet-matching code as a C program fragment. 81.It Fl ddd 82Dump packet-matching code as decimal numbers 83preceded with a count. 84.It Xo 85.Fl E 86.Sm off 87.Op Ar espalg No \&: 88.Ar espkey 89.Xc 90.Sm on 91Try to decrypt RFC 2406 ESP 92.Pq Encapsulating Security Payload 93traffic using the specified hex key 94.Ar espkey . 95Supported algorithms for 96.Ar espalg 97are: 98.Cm aes128 , 99.Cm aes128-hmac96 , 100.Cm blowfish , 101.Cm blowfish-hmac96 , 102.Cm cast , 103.Cm cast-hmac96 , 104.Cm des3 , 105.Cm des3-hmac96 , 106.Cm des 107and 108.Cm des-hmac96 . 109The algorithm defaults to 110.Cm aes128-hmac96 . 111This option should be used for debugging only, since the key will show up in 112.Xr ps 1 113output. 114.It Fl e 115Print the link-level header on each dump line. 116.It Fl F Ar file 117Use 118.Ar file 119as input for the filter expression. 120Any additional expressions given on the command line are ignored. 121.It Fl f 122Print 123.Dq foreign 124internet addresses numerically rather than symbolically. 125This option is intended to get around serious brain damage in 126Sun's yp server \(em usually it hangs forever translating non-local 127internet numbers. 128.It Fl I 129Print the interface on each dump line. 130.It Fl i Ar interface 131Listen on 132.Ar interface . 133If unspecified, 134.Nm 135searches the system interface list for the lowest numbered, configured 136.Dq up 137interface 138.Pq excluding loopback . 139Ties are broken by choosing the earliest match. 140.It Fl L 141List the supported data link types for the interface and exit. 142.It Fl l 143Make stdout line buffered. 144Useful if you want to see the data while capturing it. 145For example: 146.Pp 147.Dl # tcpdump -l | tee dat 148or 149.Dl # tcpdump -l > dat & tail -f dat 150.It Fl N 151Do not print domain name qualification of host names. 152For example, if you specify this flag then 153.Nm 154will print 155.Dq nic 156instead of 157.Dq nic.ddn.mil . 158.It Fl n 159Do not convert addresses 160.Pq host addresses, port numbers, etc. 161to names. 162.It Fl O 163Do not run the packet-matching code optimizer. 164This is useful only if you suspect a bug in the optimizer. 165.It Fl o 166Print a guess of the possible operating system(s) of hosts that sent 167TCP SYN packets. 168See 169.Xr pf.os 5 170for a description of the passive operating system fingerprints. 171.It Fl p 172Do not put the interface into promiscuous mode. 173The interface might be in promiscuous mode for some other reason; hence, 174.Fl p 175cannot be used as an abbreviation for 176.Dq ether host \&"{local-hw-addr}\&" 177or 178.Dq ether broadcast . 179.It Fl q 180Quick 181.Pq quiet? 182output. 183Print less protocol information so output lines are shorter. 184.It Fl r Ar file 185Read packets from a 186.Ar file 187which was created with the 188.Fl w 189option. 190Standard input is used if 191.Ar file 192is 193.Ql - . 194.It Fl S 195Print absolute, rather than relative, TCP sequence numbers. 196.It Fl s Ar snaplen 197Analyze at most the first 198.Ar snaplen 199bytes of data from each packet rather than the default of 116. 200116 bytes is adequate for IPv6, ICMP, TCP, and UDP, 201but may truncate protocol information from name server and NFS packets 202.Pq see below . 203Packets truncated because of a limited 204.Ar snaplen 205are indicated in the output with 206.Dq Op \*(Ba Ns Em proto , 207where 208.Em proto 209is the name of the protocol level at which the truncation has occurred. 210Taking larger snapshots both increases the amount of time it takes 211to process packets and, effectively, decreases the amount of packet buffering. 212This may cause packets to be lost. 213You should limit 214.Ar snaplen 215to the smallest number that will capture the protocol information 216you're interested in. 217.It Fl T Ar type 218Force packets selected by 219.Ar expression 220to be interpreted as the specified 221.Ar type . 222Currently known types are 223.Cm vrrp 224.Pq Virtual Router Redundancy protocol , 225.Cm cnfp 226.Pq Cisco NetFlow protocol , 227.Cm rpc 228.Pq Remote Procedure Call , 229.Cm rtp 230.Pq Real-Time Applications protocol , 231.Cm rtcp 232.Pq Real-Time Applications control protocol , 233.Cm sack 234.Pq RFC 2018 TCP Selective Acknowledgements Options , 235.Cm tcp 236.Pq Transmission Control Protocol , 237.Cm vat 238.Pq Visual Audio Tool , 239and 240.Cm wb 241.Pq distributed White Board . 242.It Fl t 243Do not print a timestamp on each dump line. 244.It Fl tt 245Print an unformatted timestamp on each dump line. 246.It Fl ttt 247Print day and month in timestamp. 248.It Fl tttt 249Print timestamp difference between packets. 250.It Fl ttttt 251Print timestamp difference since the first packet. 252.It Fl v 253.Pq Slightly more 254verbose output. 255For example, the time to live 256.Pq TTL 257and type of service 258.Pq ToS 259information in an IP packet are printed. 260.It Fl vv 261Even more verbose output. 262For example, additional fields are printed from NFS reply packets. 263.It Fl w Ar file 264Write the raw packets to 265.Ar file 266rather than parsing and printing them out. 267They can be analyzed later with the 268.Fl r 269option. 270Standard output is used if 271.Ar file 272is 273.Ql - . 274.It Fl X 275Print each packet in hex and ASCII. 276If the 277.Fl e 278option is also specified, the link-level header will be included. 279The smaller of the entire packet or 280.Ar snaplen 281bytes will be printed. 282.It Fl x 283Print each packet in hex. 284If the 285.Fl e 286option is also specified, the link-level header will be included. 287The smaller of the entire packet or 288.Ar snaplen 289bytes will be printed. 290.It Fl y Ar datalinktype 291Set the data link type to use while capturing to 292.Ar datalinktype . 293Commonly used types include 294.Cm EN10MB , 295.Cm IEEE802_11 , 296and 297.Cm IEEE802_11_RADIO . 298The choices applicable to a particular device can be listed using 299.Fl L . 300.El 301.Pp 302.Ar expression 303selects which packets will be dumped. 304If no 305.Ar expression 306is given, all packets on the net will be dumped. 307Otherwise, only packets satisfying 308.Ar expression 309will be dumped. 310.Pp 311The 312.Ar expression 313consists of one or more primitives. 314Primitives usually consist of an 315.Ar id 316.Pq name or number 317preceded by one or more qualifiers. 318There are three different kinds of qualifiers: 319.Bl -tag -width "proto" 320.It Ar type 321Specify which kind of address component the 322.Ar id 323name or number refers to. 324Possible types are 325.Cm host , 326.Cm net 327and 328.Cm port . 329E.g., 330.Dq host foo , 331.Dq net 128.3 , 332.Dq port 20 . 333If there is no type qualifier, 334.Cm host 335is assumed. 336.It Ar dir 337Specify a particular transfer direction to and/or from 338.Ar id . 339Possible directions are 340.Cm src , 341.Cm dst , 342.Cm src or dst , 343.Cm src and dst , 344.Cm addr1 , 345.Cm addr2 , 346.Cm addr3 , 347and 348.Cm addr4 . 349E.g., 350.Dq src foo , 351.Dq dst net 128.3 , 352.Dq src or dst port ftp-data . 353If there is no 354.Ar dir 355qualifier, 356.Cm src or dst 357is assumed. 358The 359.Cm addr1 , 360.Cm addr2 , 361.Cm addr3 , 362and 363.Cm addr4 364qualifiers are only valid for IEEE 802.11 Wireless LAN link layers. 365For null link layers (i.e., point-to-point protocols such as SLIP 366.Pq Serial Line Internet Protocol 367or the 368.Xr pflog 4 369header), the 370.Cm inbound 371and 372.Cm outbound 373qualifiers can be used to specify a desired direction. 374.It Ar proto 375Restrict the match to a particular protocol. 376Possible protocols are: 377.Cm ah , 378.Cm arp , 379.Cm atalk , 380.Cm decnet , 381.Cm esp , 382.Cm ether , 383.Cm fddi , 384.Cm icmp , 385.Cm icmp6 , 386.Cm igmp , 387.Cm igrp , 388.Cm ip , 389.Cm ip6 , 390.Cm lat , 391.Cm mopdl , 392.Cm moprc , 393.Cm pim , 394.Cm rarp , 395.Cm sca , 396.Cm stp , 397.Cm tcp , 398.Cm udp , 399and 400.Cm wlan . 401E.g., 402.Dq ether src foo , 403.Dq arp net 128.3 , 404.Dq tcp port 21 , 405.Dq wlan addr1 0:2:3:4:5:6 . 406If there is no protocol qualifier, 407all protocols consistent with the type are assumed. 408E.g., 409.Dq src foo 410means 411.Do 412.Pq ip or arp or rarp 413src foo 414.Dc 415.Pq except the latter is not legal syntax ; 416.Dq net bar 417means 418.Do 419.Pq ip or arp or rarp 420net bar 421.Dc ; 422and 423.Dq port 53 424means 425.Do 426.Pq TCP or UDP 427port 53 428.Dc . 429.Pp 430.Cm fddi 431is actually an alias for 432.Cm ether ; 433the parser treats them identically as meaning 434.Qo 435the data link level used on the specified network interface 436.Qc . 437FDDI 438.Pq Fiber Distributed Data Interface 439headers contain Ethernet-like source and destination addresses, 440and often contain Ethernet-like packet types, 441so you can filter on these FDDI fields just as with the analogous 442Ethernet fields. 443FDDI headers also contain other fields, 444but you cannot name them explicitly in a filter expression. 445.El 446.Pp 447In addition to the above, there are some special primitive 448keywords that don't follow the pattern: 449.Cm gateway , 450.Cm broadcast , 451.Cm less , 452.Cm greater , 453and arithmetic expressions. 454All of these are described below. 455.Pp 456More complex filter expressions are built up by using the words 457.Cm and , 458.Cm or , 459and 460.Cm not 461to combine primitives 462e.g., 463.Do 464host foo and not port ftp and not port ftp-data 465.Dc . 466To save typing, identical qualifier lists can be omitted 467e.g., 468.Dq tcp dst port ftp or ftp-data or domain 469is exactly the same as 470.Do 471tcp dst port ftp or tcp dst port ftp-data or tcp dst port domain 472.Dc . 473.Pp 474Allowable primitives are: 475.Bl -tag -width "ether proto proto" 476.It Cm dst host Ar host 477True if the IP destination field of the packet is 478.Ar host , 479which may be either an address or a name. 480.It Cm src host Ar host 481True if the IP source field of the packet is 482.Ar host . 483.It Cm host Ar host 484True if either the IP source or destination of the packet is 485.Ar host . 486.Pp 487Any of the above 488.Ar host 489expressions can be prepended with the keywords, 490.Cm ip , 491.Cm arp , 492or 493.Cm rarp 494as in: 495.Pp 496.D1 Cm ip host Ar host 497.Pp 498which is equivalent to: 499.Bd -ragged -offset indent 500.Cm ether proto 501.Ar ip 502.Cm and host 503.Ar host 504.Ed 505.Pp 506If 507.Ar host 508is a name with multiple IP addresses, each address will be checked for a match. 509.It Cm ether dst Ar ehost 510True if the Ethernet destination address is 511.Ar ehost . 512.Ar ehost 513may be either a name from 514.Pa /etc/ethers 515or a number (see 516.Xr ethers 3 517for a numeric format). 518.It Cm ether src Ar ehost 519True if the Ethernet source address is 520.Ar ehost . 521.It Cm ether host Ar ehost 522True if either the Ethernet source or destination address is 523.Ar ehost . 524.It Cm gateway Ar host 525True if the packet used 526.Ar host 527as a gateway; i.e., the Ethernet source or destination address was 528.Ar host 529but neither the IP source nor the IP destination was 530.Ar host . 531.Ar host 532must be a name and must be found in both 533.Pa /etc/hosts 534and 535.Pa /etc/ethers . 536An equivalent expression is 537.Bd -ragged -offset indent 538.Cm ether host 539.Ar ehost 540.Cm and not host 541.Ar host 542.Ed 543.Pp 544which can be used with either names or numbers for 545.Ar host Ns / Ns Ar ehost . 546.It Cm dst net Ar net 547True if the IP destination address of the packet has a network number of 548.Ar net . 549.Ar net 550may be either a name from 551.Pa /etc/networks 552or a network number (see 553.Xr networks 5 554for details). 555.It Cm src net Ar net 556True if the IP source address of the packet has a network number of 557.Ar net . 558.It Cm net Ar net 559True if either the IP source or destination address of the packet 560has a network number of 561.Ar net . 562.It Cm dst port Ar port 563True if the packet is IP/TCP or IP/UDP and has a destination port value of 564.Ar port . 565The 566.Ar port 567can be a number or name from 568.Xr services 5 569(see 570.Xr tcp 4 571and 572.Xr udp 4 ) . 573If a name is used, both the port number and protocol are checked. 574If a number or ambiguous name is used, only the port number is checked; 575e.g., 576.Dq Cm dst port No 513 577will print both TCP/login traffic and UDP/who traffic, and 578.Dq Cm dst port No domain 579will print both TCP/domain and UDP/domain traffic. 580.It Cm src port Ar port 581True if the packet has a source port value of 582.Ar port . 583.It Cm port Ar port 584True if either the source or destination port of the packet is 585.Ar port . 586.Pp 587Any of the above port expressions can be prepended with the keywords 588.Cm tcp 589or 590.Cm udp , 591as in: 592.Pp 593.D1 Cm tcp src port Ar port 594.Pp 595which matches only TCP packets whose source port is 596.Ar port . 597.It Cm less Ar length 598True if the packet has a length less than or equal to 599.Ar length . 600This is equivalent to: 601.Pp 602.D1 Cm len <= Ar length 603.Pp 604.It Cm greater Ar length 605True if the packet has a length greater than or equal to 606.Ar length . 607This is equivalent to: 608.Pp 609.D1 Cm len >= Ar length 610.Pp 611.It Cm ip proto Ar proto 612True if the packet is an IP packet (see 613.Xr ip 4 ) 614of protocol type 615.Ar proto . 616.Ar proto 617can be a number or name from 618.Xr protocols 5 , 619such as 620.Cm icmp , 621.Cm udp , 622or 623.Cm tcp . 624These identifiers are also keywords and must be escaped 625using a backslash character 626.Pq Sq \e . 627.It Cm ether broadcast 628True if the packet is an Ethernet broadcast packet. 629The 630.Cm ether 631keyword is optional. 632.It Cm ip broadcast 633True if the packet is an IP broadcast packet. 634It checks for both the all-zeroes and all-ones broadcast conventions 635and looks up the local subnet mask. 636.It Cm ether multicast 637True if the packet is an Ethernet multicast packet. 638The 639.Cm ether 640keyword is optional. 641This is shorthand for 642.Do 643.Cm ether Ns [0] & 1 != 0 644.Dc . 645.It Cm ip multicast 646True if the packet is an IP multicast packet. 647.It Cm ether proto Ar proto 648True if the packet is of ether type 649.Ar proto . 650.Ar proto 651can be a number or one of the names 652.Cm ip , 653.Cm ip6 , 654.Cm arp , 655.Cm rarp , 656.Cm atalk , 657.Cm atalkarp , 658.Cm decnet , 659.Cm decdts , 660.Cm decdns , 661.Cm lanbridge , 662.Cm lat , 663.Cm mopdl , 664.Cm moprc , 665.Cm pup , 666.Cm sca , 667.Cm sprite , 668.Cm stp , 669.Cm vexp , 670.Cm vprod , 671or 672.Cm xns . 673These identifiers are also keywords and must be escaped 674using a backslash character 675.Pq Sq \e . 676In the case of FDDI (e.g., 677.Dq Cm fddi protocol arp ) , 678the protocol identification comes from the 802.2 Logical Link Control 679.Pq LLC 680header, which is usually layered on top of the FDDI header. 681.Nm 682assumes, when filtering on the protocol identifier, that all FDDI packets 683include an LLC header, and that the LLC header is in so-called SNAP format. 684.It Cm decnet src Ar host 685True if the 686.Tn DECNET 687source address is 688.Ar host , 689which may be an address of the form 690.Dq 10.123 , 691or a 692.Tn DECNET 693host name. 694.Tn DECNET 695host name support is only available on systems that are configured to run 696.Tn DECNET . 697.It Cm decnet dst Ar host 698True if the 699.Tn DECNET 700destination address is 701.Ar host . 702.It Cm decnet host Ar host 703True if either the 704.Tn DECNET 705source or destination address is 706.Ar host . 707.It Cm ifname Ar interface 708True if the packet was logged as coming from the specified interface 709(applies only to packets logged by 710.Xr pf 4 ) . 711.It Cm on Ar interface 712Synonymous with the 713.Ar ifname 714modifier. 715.It Cm rnr Ar num 716True if the packet was logged as matching the specified PF rule number 717in the main ruleset (applies only to packets logged by 718.Xr pf 4 ) . 719.It Cm rulenum Ar num 720Synonymous with the 721.Ar rnr 722modifier. 723.It Cm reason Ar code 724True if the packet was logged with the specified PF reason code. 725The known codes are: 726.Ar match , 727.Ar bad-offset , 728.Ar fragment , 729.Ar short , 730.Ar normalize , 731.Ar memory , 732.Ar bad-timestamp , 733.Ar congestion , 734.Ar ip-option , 735.Ar proto-cksum , 736.Ar state-mismatch , 737.Ar state-insert , 738.Ar state-limit , 739.Ar src-limit , 740and 741.Ar synproxy 742(applies only to packets logged by 743.Xr pf 4 ) . 744.It Cm rset Ar name 745True if the packet was logged as matching the specified PF ruleset 746name of an anchored ruleset (applies only to packets logged by 747.Xr pf 4 ) . 748.It Cm ruleset Ar name 749Synonymous with the 750.Ar rset 751modifier. 752.It Cm srnr Ar num 753True if the packet was logged as matching the specified PF rule number 754of an anchored ruleset (applies only to packets logged by 755.Xr pf 4 ) . 756.It Cm subrulenum Ar num 757Synonymous with the 758.Ar srnr 759modifier. 760.It Cm action Ar act 761True if PF took the specified action when the packet was logged. 762Valid actions are: 763.Ar pass , 764.Ar block , 765and 766.Ar match 767(applies only to packets logged by 768.Xr pf 4 ) . 769.It Cm wlan addr1 Ar ehost 770True if the first IEEE 802.11 address is 771.Ar ehost . 772.It Cm wlan addr2 Ar ehost 773True if the second IEEE 802.11 address is 774.Ar ehost . 775.It Cm wlan addr3 Ar ehost 776True if the third IEEE 802.11 address is 777.Ar ehost . 778.It Cm wlan addr4 Ar ehost 779True if the fourth IEEE 802.11 address is 780.Ar ehost . 781The fourth address field is only used for 782WDS (Wireless Distribution System) frames. 783.It Cm wlan host Ar ehost 784True if either the first, second, third, or fourth 785IEEE 802.11 address is 786.Ar ehost . 787.It Cm type Ar type 788True if the IEEE 802.11 frame type matches the specified 789.Ar type . 790Valid types are: 791.Ar data , 792.Ar mgt , 793.Ar ctl , 794or a numeric value. 795.It Cm subtype Ar subtype 796True if the IEEE 802.11 frame subtype matches the specified 797.Ar subtype . 798Valid subtypes are: 799.Ar assocreq , 800.Ar assocresp , 801.Ar reassocreq , 802.Ar reassocresp , 803.Ar probereq , 804.Ar proberesp , 805.Ar beacon , 806.Ar atim , 807.Ar disassoc , 808.Ar auth , 809.Ar deauth , 810.Ar data , 811or a numeric value. 812.It Cm dir Ar dir 813True if the IEEE 802.11 frame direction matches the specified 814.Ar dir . 815Valid directions are: 816.Ar nods , 817.Ar tods , 818.Ar fromds , 819.Ar dstods , 820or a numeric value. 821.It Xo 822.Cm atalk , 823.Cm ip , 824.Cm ip6 , 825.Cm arp , 826.Cm decnet , 827.Cm lat , 828.Cm moprc , 829.Cm mopdl , 830.Cm rarp , 831.Cm sca 832.Xc 833Abbreviations for: 834.Cm ether proto Ar p 835where 836.Ar p 837is one of the above protocols. 838.Nm 839does not currently know how to parse 840.Cm lat , 841.Cm moprc , 842or 843.Cm mopdl . 844.It Xo 845.Cm ah , 846.Cm esp , 847.Cm icmp , 848.Cm icmp6 , 849.Cm igmp , 850.Cm igrp , 851.Cm pim , 852.Cm tcp , 853.Cm udp 854.Xc 855Abbreviations for: 856.Cm ip proto Ar p 857where 858.Ar p 859is one of the above protocols. 860.It Ar expr relop expr 861True if the relation holds, where 862.Ar relop 863is one of 864.Ql > , 865.Ql < , 866.Ql >= , 867.Ql <= , 868.Ql = , 869.Ql != , 870and 871.Ar expr 872is an arithmetic expression composed of integer constants 873.Pq expressed in standard C syntax , 874the normal binary operators 875.Pf ( Ns Ql + , 876.Ql - , 877.Ql * , 878.Ql / , 879.Ql & , 880.Ql | ) , 881a length operator, and special packet data accessors. 882To access data inside the packet, use the following syntax: 883.Sm off 884.Bd -ragged -offset indent 885.Ar proto Op Ar expr : Ar size 886.Ed 887.Sm on 888.Pp 889.Ar proto 890is one of 891.Cm ether , 892.Cm fddi , 893.Cm ip , 894.Cm arp , 895.Cm rarp , 896.Cm tcp , 897.Cm udp , 898or 899.Cm icmp , 900and indicates the protocol layer for the index operation. 901The byte offset, relative to the indicated protocol layer, is given by 902.Ar expr . 903.Ar size 904is optional and indicates the number of bytes in the field of interest; 905it can be either one, two, or four, and defaults to one. 906The length operator, indicated by the keyword 907.Cm len , 908gives the length of the packet. 909.Pp 910For example, 911.Dq Cm ether Ns [0] & 1 != 0 912catches all multicast traffic. 913The expression 914.Dq Cm ip Ns [0] & 0xf != 5 915catches all IP packets with options. 916The expression 917.Dq Cm ip Ns [6:2] & 0x1fff = 0 918catches only unfragmented datagrams and frag zero of fragmented datagrams. 919This check is implicitly applied to the 920.Cm tcp 921and 922.Cm udp 923index operations. 924For instance, 925.Dq Cm tcp Ns [0] 926always means the first byte of the TCP header, 927and never means the first byte of an intervening fragment. 928.El 929.Pp 930Primitives may be combined using a parenthesized group of primitives and 931operators. 932Parentheses are special to the shell and must be escaped. 933Allowable primitives and operators are: 934.Bd -ragged -offset indent 935Negation 936.Po 937.Dq Cm \&! 938or 939.Dq Cm not 940.Pc 941.Pp 942Concatenation 943.Po 944.Dq Cm && 945or 946.Dq Cm and 947.Pc 948.Pp 949Alternation 950.Po 951.Dq Cm || 952or 953.Dq Cm or 954.Pc 955.Ed 956.Pp 957Negation has highest precedence. 958Alternation and concatenation have equal precedence and associate left to right. 959Explicit 960.Cm and 961tokens, not juxtaposition, 962are now required for concatenation. 963.Pp 964If an identifier is given without a keyword, the most recent keyword is assumed. 965For example, 966.Bd -ragged -offset indent 967.Cm not host 968vs 969.Cm and 970ace 971.Ed 972.Pp 973is short for 974.Bd -ragged -offset indent 975.Cm not host 976vs 977.Cm and host 978ace 979.Ed 980.Pp 981which should not be confused with 982.Bd -ragged -offset indent 983.Cm not 984.Pq Cm host No vs Cm or No ace 985.Ed 986.Pp 987Expression arguments can be passed to 988.Nm 989as either a single argument or as multiple arguments, 990whichever is more convenient. 991Generally, if the expression contains shell metacharacters, 992it is easier to pass it as a single, quoted argument. 993Multiple arguments are concatenated with spaces before being parsed. 994.Sh EXAMPLES 995To print all packets arriving at or departing from sundown: 996.Pp 997.Dl # tcpdump host sundown 998.Pp 999To print traffic between helios and either hot or ace 1000(the expression is quoted to prevent the shell from mis-interpreting 1001the parentheses): 1002.Pp 1003.Dl # tcpdump 'host helios and (hot or ace)' 1004.Pp 1005To print all IP packets between ace and any host except helios: 1006.Pp 1007.Dl # tcpdump ip host ace and not helios 1008.Pp 1009To print all traffic between local hosts and hosts at Berkeley: 1010.Pp 1011.Dl # tcpdump net ucb-ether 1012.Pp 1013To print all FTP traffic through internet gateway snup: 1014.Pp 1015.Dl # tcpdump 'gateway snup and (port ftp or ftp-data)' 1016.Pp 1017To print traffic neither sourced from nor destined for local hosts 1018(if you gateway to one other net, this stuff should never make it onto 1019your local net): 1020.Pp 1021.Dl # tcpdump ip and not net localnet 1022.Pp 1023To print the start and end packets 1024.Pq the SYN and FIN packets 1025of each TCP connection that involves a non-local host: 1026.Bd -literal -offset indent 1027# tcpdump 'tcp[13] & 3 != 0 and not src and dst net localnet' 1028.Ed 1029.Pp 1030To print only the SYN packets of http connections 1031.Pp 1032.Dl # tcpdump 'tcp[tcpflags] = tcp-syn and port http' 1033.Pp 1034To print IP packets longer than 576 bytes sent through gateway snup: 1035.Pp 1036.Dl # tcpdump 'gateway snup and ip[2:2] > 576' 1037.Pp 1038To print IP broadcast or multicast packets that were 1039.Em not 1040sent via Ethernet broadcast or multicast: 1041.Bd -literal -offset indent 1042# tcpdump 'ether[0] & 1 = 0 and ip[16] >= 224' 1043.Ed 1044.Pp 1045To print all ICMP packets that are not echo requests/replies 1046.Pq i.e., not ping packets : 1047.Pp 1048.Dl # tcpdump 'icmp[0] != 8 and icmp[0] != 0' 1049.Pp 1050To print only echo request ICMP packets: 1051.Pp 1052.Dl # tcpdump 'icmp[icmptype] = icmp-echo' 1053.Pp 1054To print and decrypt all ESP packets with SPI 0x00001234: 1055.Pp 1056.Dl # tcpdump -E des3-hmac96:ab...def 'ip[20:4] = 0x00001234' 1057.Sh OUTPUT FORMAT 1058The output of 1059.Nm 1060is protocol dependent. 1061The following gives a brief description and examples of most of the formats. 1062.Ss Link Level Headers 1063If the 1064.Fl e 1065option is given, the link level header is printed out. 1066On Ethernets, the source and destination addresses, protocol, 1067and packet length are printed. 1068.Pp 1069On the packet filter logging interface 1070.Xr pflog 4 , 1071logging reason 1072.Pq rule match, bad-offset, fragment, bad-timestamp, short, normalize, memory , 1073action taken 1074.Pq pass/block , 1075direction 1076.Pq in/out 1077and interface information are printed out for each packet. 1078.Pp 1079On FDDI networks, the 1080.Fl e 1081option causes 1082.Nm 1083to print the frame control field, the source and destination addresses, 1084and the packet length. 1085The frame control field governs the interpretation of the rest of the packet. 1086Normal packets 1087.Pq such as those containing IP datagrams 1088are 1089.Dq async 1090packets, with a priority value between 0 and 7; for example, 1091.Sy async4 . 1092Such packets are assumed to contain an 802.2 Logical Link Control 1093.Pq LLC 1094packet; the LLC header is printed if it is 1095.Em not 1096an ISO datagram or a so-called SNAP packet. 1097.Pp 1098The following description assumes familiarity with the 1099SLIP compression algorithm described in RFC 1144. 1100.Pp 1101On SLIP links, a direction indicator 1102.Po 1103.Ql I 1104for inbound, 1105.Ql O 1106for outbound 1107.Pc , 1108packet type, and compression information are printed out. 1109The packet type is printed first. 1110The three types are 1111.Cm ip , 1112.Cm utcp , 1113and 1114.Cm ctcp . 1115No further link information is printed for IP packets. 1116For TCP packets, the connection identifier is printed following the type. 1117If the packet is compressed, its encoded header is printed out. 1118The special cases are printed out as 1119.Cm *S+ Ns Ar n 1120and 1121.Cm *SA+ Ns Ar n , 1122where 1123.Ar n 1124is the amount by which the sequence number 1125.Pq or sequence number and ack 1126has changed. 1127If it is not a special case, zero or more changes are printed. 1128A change is indicated by 1129.Sq U 1130.Pq urgent pointer , 1131.Sq W 1132.Pq window , 1133.Sq A 1134.Pq ack , 1135.Sq S 1136.Pq sequence number , 1137and 1138.Sq I 1139.Pq packet ID , 1140followed by a delta 1141.Pq +n or -n , 1142or a new value 1143.Pq =n . 1144Finally, the amount of data in the packet and compressed header length 1145are printed. 1146.Pp 1147For example, the following line shows an outbound compressed TCP packet, 1148with an implicit connection identifier; the ack has changed by 6, 1149the sequence number by 49, and the packet ID by 6; 1150there are 3 bytes of data and 6 bytes of compressed header: 1151.Bd -ragged -offset indent 1152O 1153.Cm ctcp No * 1154.Cm A No +6 1155.Cm S No +49 1156.Cm I No +6 3 1157.Pq 6 1158.Ed 1159.Ss ARP/RARP Packets 1160arp/rarp output shows the type of request and its arguments. 1161The format is intended to be self-explanatory. 1162Here is a short sample taken from the start of an rlogin 1163from host rtsg to host csam: 1164.Bd -literal -offset indent 1165arp who-has csam tell rtsg 1166arp reply csam is-at CSAM 1167.Ed 1168.Pp 1169In this example, Ethernet addresses are in caps and internet addresses 1170in lower case. 1171The first line says that rtsg sent an arp packet asking for 1172the Ethernet address of internet host csam. 1173csam replies with its Ethernet address CSAM. 1174.Pp 1175This would look less redundant if we had done 1176.Nm 1177.Fl n : 1178.Bd -literal -offset indent 1179arp who-has 128.3.254.6 tell 128.3.254.68 1180arp reply 128.3.254.6 is-at 02:07:01:00:01:c4 1181.Ed 1182.Pp 1183If we had done 1184.Nm 1185.Fl e , 1186the fact that the first packet is 1187broadcast and the second is point-to-point would be visible: 1188.Bd -literal -offset indent 1189RTSG Broadcast 0806 64: arp who-has csam tell rtsg 1190CSAM RTSG 0806 64: arp reply csam is-at CSAM 1191.Ed 1192.Pp 1193For the first packet this says the Ethernet source address is RTSG, 1194the destination is the Ethernet broadcast address, 1195the type field contained hex 0806 (type 1196.Dv ETHER_ARP ) 1197and the total length was 64 bytes. 1198.Ss TCP Packets 1199The following description assumes familiarity with the TCP protocol 1200described in RFC 793. 1201If you are not familiar with the protocol, neither this description nor 1202.Nm 1203will be of much use to you. 1204.Pp 1205The general format of a TCP protocol line is: 1206.Bd -ragged -offset indent 1207.Ar src No > Ar dst : 1208.Ar flags src-os data-seqno ack window urgent options 1209.Ed 1210.Pp 1211.Ar src 1212and 1213.Ar dst 1214are the source and destination IP addresses and ports. 1215.Ar flags 1216is some combination of 1217.Sq S 1218.Pq Tn SYN , 1219.Sq F 1220.Pq Tn FIN , 1221.Sq P 1222.Pq Tn PUSH , 1223or 1224.Sq R 1225.Pq Tn RST , 1226.Sq W 1227.Pq Tn congestion Window reduced , 1228.Sq E 1229.Pq Tn ecn ECHO 1230or a single 1231.Ql \&. 1232.Pq no flags . 1233.Ar src-os 1234will list a guess of the source host's operating system if the 1235.Fl o 1236command line flag was passed to 1237.Nm tcpdump . 1238.Ar data-seqno 1239describes the portion of sequence space covered 1240by the data in this packet 1241.Pq see example below . 1242.Ar ack 1243is the sequence number of the next data expected by the other 1244end of this connection. 1245.Ar window 1246is the number of bytes of receive buffer space available 1247at the other end of this connection. 1248.Ar urg 1249indicates there is urgent data in the packet. 1250.Ar options 1251are TCP options enclosed in angle brackets e.g., 1252.Aq mss 1024 . 1253.Pp 1254.Ar src , dst 1255and 1256.Ar flags 1257are always present. 1258The other fields depend on the contents of the packet's TCP protocol header and 1259are output only if appropriate. 1260.Pp 1261Here is the opening portion of an rlogin from host rtsg to host csam. 1262.Bd -unfilled -offset 2n 1263rtsg.1023 > csam.login: S 768512:768512(0) win 4096 <mss 1024> 1264csam.login > rtsg.1023: S 947648:947648(0) ack 768513 win 4096 <mss 1024> 1265rtsg.1023 > csam.login: . ack 1 win 4096 1266rtsg.1023 > csam.login: P 1:2(1) ack 1 win 4096 1267csam.login > rtsg.1023: . ack 2 win 4096 1268rtsg.1023 > csam.login: P 2:21(19) ack 1 win 4096 1269csam.login > rtsg.1023: P 1:2(1) ack 21 win 4077 1270csam.login > rtsg.1023: P 2:3(1) ack 21 win 4077 urg 1 1271csam.login > rtsg.1023: P 3:4(1) ack 21 win 4077 urg 1 1272.Ed 1273.Pp 1274The first line says that TCP port 1023 on rtsg sent a packet 1275to port login on host csam. 1276The 1277.Ql S 1278indicates that the SYN flag was set. 1279The packet sequence number was 768512 and it contained no data. 1280The notation is 1281.Sm off 1282.So 1283.Ar first : last 1284.Po Ar nbytes 1285.Pc 1286.Sc 1287.Sm on 1288which means sequence numbers 1289.Ar first 1290up to but not including 1291.Ar last 1292which is 1293.Ar nbytes 1294bytes of user data. 1295There was no piggy-backed ack, the available receive window was 4096 1296bytes and there was a max-segment-size option requesting an mss of 1024 bytes. 1297.Pp 1298Csam replies with a similar packet except it includes a piggy-backed 1299ack for rtsg's SYN. 1300Rtsg then acks csam's SYN. 1301The 1302.Ql \&. 1303means no flags were set. 1304The packet contained no data so there is no data sequence number. 1305The ack sequence number is a 32-bit integer. 1306The first time 1307.Nm 1308sees a TCP connection, it prints the sequence number from the packet. 1309On subsequent packets of the connection, the difference between 1310the current packet's sequence number and this initial sequence number 1311is printed. 1312This means that sequence numbers after the first can be interpreted 1313as relative byte positions in the connection's data stream 1314.Po 1315with the first data byte each direction being 1 1316.Pc . 1317.Fl S 1318will override this 1319feature, causing the original sequence numbers to be output. 1320.Pp 1321On the 6th line, rtsg sends csam 19 bytes of data 1322.Po 1323bytes 2 through 20 1324in the rtsg -> csam side of the connection 1325.Pc . 1326The PUSH flag is set in the packet. 1327On the 7th line, csam says it's received data sent by rtsg up to 1328but not including byte 21. 1329Most of this data is apparently sitting in the socket buffer 1330since csam's receive window has gotten 19 bytes smaller. 1331Csam also sends one byte of data to rtsg in this packet. 1332On the 8th and 9th lines, 1333csam sends two bytes of urgent, pushed data to rtsg. 1334.Ss UDP Packets 1335UDP format is illustrated by this rwho packet: 1336.Pp 1337.D1 actinide.who > broadcast.who: udp 84 1338.Pp 1339This says that port who on host actinide sent a UDP datagram to port 1340who on host broadcast, the Internet broadcast address. 1341The packet contained 84 bytes of user data. 1342.Pp 1343Some UDP services are recognized 1344.Pq from the source or destination port number 1345and the higher level protocol information printed. 1346In particular, Domain Name service requests 1347.Pq RFC 1034/1035 1348and Sun RPC calls 1349.Pq RFC 1050 1350to NFS. 1351.Ss UDP Name Server Requests 1352The following description assumes familiarity with 1353the Domain Service protocol described in RFC 1035. 1354If you are not familiar with the protocol, 1355the following description will appear to be written in Greek. 1356.Pp 1357Name server requests are formatted as 1358.Bd -ragged -offset indent 1359.Ar src 1360> 1361.Ar dst : 1362.Ar id op Ns ?\& 1363.Ar flags qtype qclass name 1364.Pq Ar len 1365.Ed 1366.Pp 1367For example: 1368.Pp 1369.D1 h2opolo.1538 > helios.domain: 3+ A? ucbvax.berkeley.edu. (37) 1370.Pp 1371Host h2opolo asked the domain server on helios for an address record 1372.Pq Ar qtype Ns =A 1373associated with the name 1374ucbvax.berkeley.edu. 1375The query 1376.Ar id 1377was 3. 1378The 1379.Ql + 1380indicates the recursion desired flag was set. 1381The query length was 37 bytes, not including the UDP and IP protocol headers. 1382The query operation was the normal one 1383.Pq Query 1384so the 1385.Ar op 1386field was omitted. 1387If 1388.Ar op 1389had been anything else, it would have been printed between the 3 and the 1390.Ql + . 1391Similarly, the 1392.Ar qclass 1393was the normal one 1394.Pq Tn C_IN 1395and was omitted. 1396Any other 1397.Ar qclass 1398would have been printed immediately after the A. 1399.Pp 1400A few anomalies are checked and may result in extra fields enclosed in 1401square brackets: if a query contains an answer, name server or 1402authority section, 1403.Ar ancount , 1404.Ar nscount , 1405or 1406.Ar arcount 1407are printed as 1408.Dq Bq Ar n Ns a , 1409.Dq Bq Ar n Ns n , 1410or 1411.Dq Bq Ar n Ns au 1412where 1413.Ar n 1414is the appropriate count. 1415If any of the response bits are set 1416.Po 1417AA, RA or rcode 1418.Pc 1419or any of the 1420.Dq must be zero 1421bits are set in bytes two and three, 1422.Dq Bq b2&3= Ns Ar x 1423is printed, where 1424.Ar x 1425is the hex value of header bytes two and three. 1426.Ss UDP Name Server Responses 1427Name server responses are formatted as 1428.Bd -ragged -offset indent 1429.Ar src No > Ar dst : 1430.Ar id op rcode flags 1431.Ar a 1432/ 1433.Ar n 1434/ 1435.Ar au 1436.Ar type class data 1437.Pq Ar len 1438.Ed 1439.Pp 1440For example: 1441.Bd -unfilled -offset indent 1442helios.domain > h2opolo.1538: 3 3/3/7 A 128.32.137.3 (273) 1443helios.domain > h2opolo.1537: 2 NXDomain* 0/1/0 (97) 1444.Ed 1445.Pp 1446In the first example, helios responds to query 1447.Ar id 14483 from h2opolo 1449with 3 answer records, 3 name server records and 7 authority records. 1450The first answer record is type A 1451.Pq address and its data is internet 1452address 128.32.137.3. 1453The total size of the response was 273 bytes, excluding UDP and IP headers. 1454The 1455.Ar op 1456.Pq Query 1457and 1458.Ar rcode 1459.Pq NoError 1460were omitted, as was the 1461.Ar class 1462.Pq C_IN 1463of the A record. 1464.Pp 1465In the second example, helios responds to query 1466.Ar op 14672 with an 1468.Ar rcode 1469of non-existent domain 1470.Pq NXDomain 1471with no answers, 1472one name server and no authority records. 1473The 1474.Ql * 1475indicates that the authoritative answer bit was set. 1476Since there were no answers, no 1477.Ar type , 1478.Ar class 1479or 1480.Ar data 1481were printed. 1482.Pp 1483Other flag characters that might appear are 1484.Sq - 1485(recursion available, RA, 1486.Em not 1487set) 1488and 1489.Sq \*(Ba 1490.Pq truncated message, TC, set . 1491If the question section doesn't contain exactly one entry, 1492.Dq Bq Ar n Ns q 1493is printed. 1494.Pp 1495Name server requests and responses tend to be large and the default 1496.Ar snaplen 1497of 96 bytes may not capture enough of the packet to print. 1498Use the 1499.Fl s 1500flag to increase the 1501.Ar snaplen 1502if you need to seriously investigate name server traffic. 1503.Dq Fl s No 128 1504has worked well for me. 1505.Ss NFS Requests and Replies 1506Sun NFS 1507.Pq Network File System 1508requests and replies are printed as: 1509.Bd -ragged -offset indent 1510.Ar src . Ns Ar xid 1511> 1512.Ar dst . Ns nfs : 1513.Ar len op args 1514.Pp 1515.Ar src . Ns nfs 1516> 1517.Ar dst . Ns Ar xid : 1518reply 1519.Ar stat len op results 1520.Ed 1521.Bd -unfilled -offset indent 1522sushi.6709 > wrl.nfs: 112 readlink fh 21,24/10.73165 1523wrl.nfs > sushi.6709: reply ok 40 readlink "../var" 1524sushi.201b > wrl.nfs: 1525 144 lookup fh 9,74/4096.6878 "xcolors" 1526wrl.nfs > sushi.201b: 1527 reply ok 128 lookup fh 9,74/4134.3150 1528.Ed 1529.Pp 1530In the first line, host sushi sends a transaction with ID 6709 to wrl. 1531The number following the src host is a transaction ID, 1532.Em not 1533the source port. 1534The request was 112 bytes, excluding the UDP and IP headers. 1535The 1536.Ar op 1537was a readlink 1538.Pq read symbolic link 1539on fh 1540.Pq Dq file handle 154121,24/10.731657119. 1542If one is lucky, as in this case, the file handle can be interpreted 1543as a major,minor device number pair, followed by the inode number and 1544generation number. 1545Wrl replies with a 1546.Ar stat 1547of ok and the contents of the link. 1548.Pp 1549In the third line, sushi asks wrl to look up the name 1550.Dq xcolors 1551in directory file 9,74/4096.6878. 1552The data printed depends on the operation type. 1553The format is intended to be self-explanatory 1554if read in conjunction with an NFS protocol spec. 1555.Pp 1556If the 1557.Fl v 1558.Pq verbose 1559flag is given, additional information is printed. 1560For example: 1561.Bd -unfilled -offset indent 1562sushi.1372a > wrl.nfs: 1563 148 read fh 21,11/12.195 8192 bytes @ 24576 1564wrl.nfs > sushi.1372a: 1565 reply ok 1472 read REG 100664 ids 417/0 sz 29388 1566.Ed 1567.Pp 1568.Fl v 1569also prints the IP header TTL, ID, and fragmentation fields, 1570which have been omitted from this example. 1571In the first line, sushi asks wrl to read 8192 bytes from file 21,11/12.195, 1572at byte offset 24576. 1573Wrl replies with a 1574.Ar stat of 1575ok; 1576the packet shown on the second line is the first fragment of the reply, 1577and hence is only 1472 bytes long. 1578The other bytes will follow in subsequent fragments, 1579but these fragments do not have NFS or even UDP headers and so might not be 1580printed, depending on the filter expression used. 1581Because the 1582.Fl v 1583flag is given, some of the file attributes 1584.Po 1585which are returned in addition to the file data 1586.Pc 1587are printed: the file type 1588.Pq So REG Sc , No for regular file , 1589the file mode 1590.Pq in octal , 1591the UID and GID, and the file size. 1592.Pp 1593If the 1594.Fl v 1595flag is given more than once, even more details are printed. 1596.Pp 1597NFS requests are very large and much of the detail won't be printed unless 1598.Ar snaplen 1599is increased. 1600Try using 1601.Dq Fl s No 192 1602to watch NFS traffic. 1603.Pp 1604NFS reply packets do not explicitly identify the RPC operation. 1605Instead, 1606.Nm 1607keeps track of 1608.Dq recent 1609requests, and matches them to the replies using the 1610.Ar xid 1611.Pq transaction ID . 1612If a reply does not closely follow the corresponding request, 1613it might not be parsable. 1614.Ss KIP AppleTalk (DDP in UDP) 1615AppleTalk DDP packets encapsulated in UDP datagrams 1616are de-encapsulated and dumped as DDP packets 1617.Pq i.e., all the UDP header information is discarded . 1618The file 1619.Pa /etc/atalk.names 1620is used to translate AppleTalk net and node numbers to names. 1621Lines in this file have the form 1622.Bl -column "number" "name" -offset indent 1623.It Sy "number" Ta Ta Sy "name" 1624.It "1.254" Ta Ta "ether" 1625.It "16.1" Ta Ta "icsd-net" 1626.It "1.254.110" Ta Ta "ace" 1627.El 1628.Pp 1629The first two lines give the names of AppleTalk networks. 1630The third line gives the name of a particular host 1631(a host is distinguished from a net by the 3rd octet in the number; 1632a net number 1633.Em must 1634have two octets and a host number 1635.Em must 1636have three octets). 1637The number and name should be separated by whitespace (blanks or tabs). 1638The 1639.Pa /etc/atalk.names 1640file may contain blank lines or comment lines 1641(lines starting with a 1642.Ql # ) . 1643.Pp 1644AppleTalk addresses are printed in the form 1645.Pp 1646.D1 Ar net . Ns Ar host . Ns Ar port 1647.Pp 1648For example: 1649.Bd -unfilled -offset indent 1650144.1.209.2 > icsd-net.112.220 1651office.2 > icsd-net.112.220 1652jssmag.149.235 > icsd-net.2 1653.Ed 1654.Pp 1655If 1656.Pa /etc/atalk.names 1657doesn't exist or doesn't contain an entry for some AppleTalk 1658host/net number, addresses are printed in numeric form. 1659In the first example, NBP 1660.Pq DDP port 2 1661on net 144.1 node 209 1662is sending to whatever is listening on port 220 of net icsd-net node 112. 1663The second line is the same except the full name of the source node is known 1664.Pq Dq office . 1665The third line is a send from port 235 on 1666net jssmag node 149 to broadcast on the icsd-net NBP port. 1667The broadcast address 1668.Pq 255 1669is indicated by a net name with no host number; 1670for this reason it is a good idea to keep node names and net names distinct in 1671.Pa /etc/atalk.names . 1672.Pp 1673NBP 1674.Pq name binding protocol 1675and ATP 1676.Pq AppleTalk transaction protocol 1677packets have their contents interpreted. 1678Other protocols just dump the protocol name 1679.Po 1680or number if no name is registered for the protocol 1681.Pc 1682and packet size. 1683.Pp 1684NBP packets are formatted like the following examples: 1685.Bd -unfilled 1686icsd-net.112.220 > jssmag.2: nbp-lkup 190: "=:LaserWriter@*" 1687jssmag.209.2 > icsd-net.112.220: nbp-reply 190: "RM1140:LaserWriter@*" 250 1688techpit.2 > icsd-net.112.220: nbp-reply 190: "techpit:LaserWriter@*" 186 1689.Ed 1690.Pp 1691The first line is a name lookup request for laserwriters sent by 1692net icsdi-net host 1693112 and broadcast on net jssmag. 1694The nbp ID for the lookup is 190. 1695The second line shows a reply for this request 1696.Pq note that it has the same ID 1697from host jssmag.209 saying that it has a laserwriter 1698resource named RM1140 registered on port 250. 1699The third line is another reply to the same request 1700saying host techpit has laserwriter techpit registered on port 186. 1701.Pp 1702ATP packet formatting is demonstrated by the following example: 1703.Bd -unfilled -offset indent 1704jssmag.209.165 > helios.132: atp-req 12266<0-7> 0xae030001 1705helios.132 > jssmag.209.165: atp-resp 12266:0 (512) 0xae040000 1706helios.132 > jssmag.209.165: atp-resp 12266:1 (512) 0xae040000 1707helios.132 > jssmag.209.165: atp-resp 12266:2 (512) 0xae040000 1708helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000 1709helios.132 > jssmag.209.165: atp-resp 12266:4 (512) 0xae040000 1710helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000 1711helios.132 > jssmag.209.165: atp-resp 12266:6 (512) 0xae040000 1712helios.132 > jssmag.209.165: atp-resp*12266:7 (512) 0xae040000 1713jssmag.209.165 > helios.132: atp-req 12266<3,5> 0xae030001 1714helios.132 > jssmag.209.165: atp-resp 12266:3 (512) 0xae040000 1715helios.132 > jssmag.209.165: atp-resp 12266:5 (512) 0xae040000 1716jssmag.209.165 > helios.132: atp-rel 12266<0-7> 0xae030001 1717jssmag.209.133 > helios.132: atp-req* 12267<0-7> 0xae030002 1718.Ed 1719.Pp 1720Jssmag.209 initiates transaction ID 12266 with host helios by requesting 1721up to 8 packets 1722.Sm off 1723.Pq the Dq Aq 0\-7 . 1724.Sm on 1725The hex number at the end of the line is the value of the 1726.Ar userdata 1727field in the request. 1728.Pp 1729Helios responds with 8 512-byte packets. 1730The 1731.Dq : Ns Ar n 1732following the 1733transaction ID gives the packet sequence number in the transaction 1734and the number in parentheses is the amount of data in the packet, 1735excluding the ATP header. 1736The 1737.Ql * 1738on packet 7 indicates that the EOM bit was set. 1739.Pp 1740Jssmag.209 then requests that packets 3 & 5 be retransmitted. 1741Helios resends them then jssmag.209 releases the transaction. 1742Finally, jssmag.209 initiates the next request. 1743The 1744.Ql * 1745on the request indicates that XO 1746.Pq exactly once 1747was 1748.Em not 1749set. 1750.Ss IP Fragmentation 1751Fragmented Internet datagrams are printed as 1752.Bd -ragged -offset indent 1753.Po 1754.Cm frag Ar id 1755: 1756.Ar size 1757@ 1758.Ar offset 1759.Op + 1760.Pc 1761.Ed 1762.Pp 1763A 1764.Ql + 1765indicates there are more fragments. 1766The last fragment will have no 1767.Ql + . 1768.Pp 1769.Ar id 1770is the fragment ID. 1771.Ar size 1772is the fragment size 1773.Pq in bytes 1774excluding the IP header. 1775.Ar offset 1776is this fragment's offset 1777.Pq in bytes 1778in the original datagram. 1779.Pp 1780The fragment information is output for each fragment. 1781The first fragment contains the higher level protocol header and the fragment 1782info is printed after the protocol info. 1783Fragments after the first contain no higher level protocol header and the 1784fragment info is printed after the source and destination addresses. 1785For example, here is part of an FTP from arizona.edu to lbl-rtsg.arpa 1786over a CSNET connection that doesn't appear to handle 576 byte datagrams: 1787.Bd -unfilled -offset indent 1788arizona.ftp-data > rtsg.1170: . 1024:1332(308) ack 1 win 4096 (frag 595a:328@0+) 1789arizona > rtsg: (frag 595a:204@328) 1790rtsg.1170 > arizona.ftp-data: . ack 1536 win 2560 1791.Ed 1792.Pp 1793There are a couple of things to note here: first, addresses in the 17942nd line don't include port numbers. 1795This is because the TCP protocol information is all in the first fragment 1796and we have no idea what the port or sequence numbers are when we print 1797the later fragments. 1798Second, the TCP sequence information in the first line is printed as if there 1799were 308 bytes of user data when, in fact, there are 512 bytes 1800.Po 1801308 in the first frag and 204 in the second 1802.Pc . 1803If you are looking for holes in the sequence space or trying to match up acks 1804with packets, this can fool you. 1805.Pp 1806A packet with the IP 1807.Sy don't fragment 1808flag is marked with a trailing 1809.Dq Pq Tn DF . 1810.Ss Timestamps 1811By default, all output lines are preceded by a timestamp. 1812The timestamp is the current clock time in the form 1813.Sm off 1814.Ar hh : mm : ss . frac 1815.Sm on 1816and is as accurate as the kernel's clock. 1817The timestamp reflects the time the kernel first saw the packet. 1818No attempt is made to account for the time lag between when the 1819Ethernet interface removed the packet from the wire and when the kernel 1820serviced the 1821.Dq new packet 1822interrupt. 1823.Ss IP Checksum Offload 1824Some network cards support IP checksum offload. 1825Packet headers for such interfaces erroneously indicate a bad checksum, 1826since the checksum is not calculated until after 1827.Nm 1828sees the packet. 1829.Sh SEE ALSO 1830.\" traffic(1C), nit(4P), 1831.Xr ethers 3 , 1832.Xr pcap 3 , 1833.Xr bpf 4 , 1834.Xr ip 4 , 1835.Xr pf 4 , 1836.Xr pflog 4 , 1837.Xr tcp 4 , 1838.Xr udp 4 , 1839.Xr networks 5 , 1840.Xr pf.os 5 , 1841.Xr protocols 5 , 1842.Xr services 5 1843.Rs 1844.%R RFC 793 1845.%T Transmission Control Protocol 1846.%D September 1981 1847.Re 1848.Rs 1849.%R RFC 1034 1850.%T Domain Names \- Concepts and Facilities 1851.%D November 1987 1852.Re 1853.Rs 1854.%R RFC 1035 1855.%T Domain Names \- Implementation and Specification 1856.%D November 1987 1857.Re 1858.Rs 1859.%R RFC 1050 1860.%T RPC: Remote Procedure Call 1861.%D April 1988 1862.Re 1863.Rs 1864.%R RFC 1144 1865.%T Compressing TCP/IP Headers for Low-Speed Serial Links 1866.%D February 1990 1867.Re 1868.Rs 1869.%R RFC 2018 1870.%T TCP Selective Acknowledgement Options 1871.%D October 1996 1872.Re 1873.Rs 1874.%R RFC 2406 1875.%T IP Encapsulating Security Payload (ESP) 1876.%D November 1998 1877.Re 1878.Sh AUTHORS 1879.An -nosplit 1880.An Van Jacobson Aq van@ee.lbl.gov , 1881.An Craig Leres Aq leres@ee.lbl.gov , 1882and 1883.An Steven McCanne Aq mccanne@ee.lbl.gov , 1884all of the Lawrence Berkeley Laboratory, University of California, Berkeley, CA. 1885.Sh BUGS 1886Please send bug reports to 1887.Aq tcpdump@ee.lbl.gov 1888or 1889.Aq libpcap@ee.lbl.gov . 1890.Pp 1891Some attempt should be made to reassemble IP fragments, 1892or at least to compute the right length for the higher level protocol. 1893.Pp 1894Name server inverse queries are not dumped correctly: The 1895.Pq empty 1896question section is printed rather than the real query in the answer section. 1897Some believe that inverse queries are themselves a bug and 1898prefer to fix the program generating them rather than 1899.Nm tcpdump . 1900.Pp 1901Apple Ethertalk DDP packets could be dumped as easily as KIP DDP packets 1902but aren't. 1903Even if we were inclined to do anything to promote the use of Ethertalk 1904(we aren't, LBL doesn't allow Ethertalk on any of its 1905networks so we'd have no way of testing this code). 1906.Pp 1907A packet trace that crosses a daylight saving time change will give 1908skewed time stamps 1909.Pq the time change is ignored . 1910.Pp 1911Filter expressions that manipulate FDDI headers assume that all FDDI packets 1912are encapsulated Ethernet packets. 1913This is true for IP, ARP, and 1914.Tn DECNET 1915Phase IV, 1916but is not true for protocols such as ISO CLNS. 1917Therefore, the filter may inadvertently accept certain packets that 1918do not properly match the filter expression. 1919