Tcpdump Guide
Overview
Tcpdump is a program that allows you to monitor network traffic.
Running Tcpdump
To run tcpdump, first become root by typing sudo su - and then entering your
password (the default password is malware):
$ sudo su -
[sudo] password for armc:
Don't Type the Prompt
The $ and # at the begining are prompts. Do not type them.
Once you're root, you can start tcpdump type typing tcpdump:
# tcpdump
To exit tcpdump hit Ctrl+C.
Options
Tcpdump is a flexible program, and can take many different command line options. Some common options are:
-i <interface>The interface to listen on (In the Linux guest use interface ens33, so-i ens33)-nDont resolve host names or port numbers-XShow packet contents in hex and ascii-XXShow packet headers and contents in hex and ascii-AShow packet contents in ascii-vShow verbose output-vvShow very verbose output-vvvShow very, very, verbose output
Expressions
Expressions are ways you can filter the traffic that tcpdump captures. The main elements of most expressions are: type, dir, and proto.
Common options for type are:
hostto specify traffic going to or from a given hostportto specify traffic going to or from a given port
Common options for dir are:
srcto specify a source host or portdstto specify a destination host or port
Common options for proto are:
udpfor UDP traffictcpfor TCP trafficarpfor ARP trafficicmpfor ICMP traffic
More Filters
For a more complete description see the pcap-filter man page.
Examples
To have tcpdump capture all traffic on interface ens33, but not resolve host names or port numbers:
# tcpdump -ni ens33
To have tcpdump capture only traffic going to or from port 53 (TCP or UDP), showing the hex and ascii contents of the packets, not resolving host names or port numbers, on interface ens33:
# tcpdump -nXi ens33 port 53
To have tcpdump capture only traffic going to or from UDP port 53, not resolving host names or port numbers, on interface ens33:
# tcpdump -ni ens33 udp and port 53
To have tcpdump capture all traffic except ARP, not resolving host names or port numbers, on interface ens33:
# tcpdump -ni ens33 not arp