################ ### TCP dump ### ################ #################################################################################################### ### Examples ####################################################################################### #################################################################################################### tcpdump udp dst port not 53 UDP not bound for port 53 tcpdump host 10.0.0.1 && host 10.0.0.2 Traffic between these hosts tcpdump tcp dst port 80 or 8080 Packets to either TCP port tcpdump -ni igb1 src host 192.168.1.100 That will capture all traffic to and from that host. To only capture traffic being initiated by that host, use the src directive tcpdump -ni igb1 dst host 192.168.1.100 Similarly, filtering for traffic destined to that IP address is possible by specifying dst tcpdump -ni igb1 net 192.168.1 The following command displays traffic to or from any host with a 192.168.1.x IP address tcpdump -ni igb1 net 10 The next command will capture traffic to or from any host with a 10.x.x.x IP address tcpdump -ni igb1 src net 172.16.0.0/12 A CIDR mask can also be passed as an argument to net tcpdump -ni igb1 src net 10 The src or dst keywords may be used the same as with host filters tcpdump -ni igb1 tcp port 80 Capture all HTTP traffic tcpdump -ni igb1 port 53 Capture all DNS traffic (usually UDP, but some queries use TCP) tcpdump -ni igb1 proto \\icmp The following capture will show all ICMP traffic on the igb1 interface tcpdump -ni igb1 host 192.168.1.11 and tcp port 80 Display all HTTP traffic to and from a host tcpdump -ni igb1 host 192.168.1.11 or host 192.168.1.15 and tcp port 80 Display all HTTP traffic from either 192.168.1.11 or 192.168.1.15 #################################################################################################### ### Command Line Options ########################################################################### #################################################################################################### -A Print frame payload in ASCII -c Exit after capturing count packets -D List available interfaces -e Print link-level headers -F Use file as the filter expression -G Rotate the dump file every n seconds -i Specifies the capture interface -K Don't verify TCP checksums -L List data link types for the interface -n Don't convert addresses to names -p Don't capture in promiscuous mode -q Quick output -r Read packets from file -s Capture up to len bytes per packet -S Print absolute TCP sequence numbers -t Don't print timestamps -v[v[v]] Print more verbose output -w Write captured packets to file -x Print frame payload in hex -X Print frame payload in hex and ASCII -y Specify the data link type -Z Drop privileges from root to user #################################################################################################### ### Capture Filter Primitives ###################################################################### #################################################################################################### [src|dst] host Matches a host as the IP source, destination, or either ether [src|dst] host Matches a host as the Ethernet source, destination, or either gateway host Matches packets which used host as a gateway [src|dst] net / Matches packets to or from an endpoint residing in network [tcp|udp] [src|dst] port Matches TCP or UDP packets sent to/from port [tcp|udp] [src|dst] portrange - Matches TCP or UDP packets to/from a port in the given range less Matches packets less than or equal to length greater Matches packets greater than or equal to length (ether|ip|ip6) proto Matches an Ethernet, IPv4, or IPv6 protocol (ether|ip) broadcast Matches Ethernet or IPv4 broadcasts (ether|ip|ip6) multicast Matches Ethernet, IPv4, or IPv6 multicasts type (mgt|ctl|data) [subtype ] Matches 802.11 frames based on type and optional subtype vlan [] Matches 802.1Q frames, optionally with a VLAN ID of vlan mpls [