published: 13th of July 2017
TCPDump is a tool for sniffing packets on a network. This is not a comprehensive tutorial, only a quick reference source. Consult the man pages and/or documentation for indepth explanation of commands.
-i <interface-name> specifies an interface.
sudo tcpdump -i eth1
sudo tcpdump -i eth1 src 172.16.20.220
sudo tcpdump -i eth1 dst 8.8.8.8
sudo tcpdump -i eth1 arp
sudo tcpdump -i eth1 icmp and dst 9.9.9.9
sudo tcpdump -i eth1 port 67 or port 68
Capture TCP and UDP
sudo tcpdump -i eth1 port 53
Capture UDP only
sudo tcpdump -i eth1 udp port 53
sudo tcpdump -i eth1 port 161 or port 162
sudo tcpdump ether host aa:bb:cc:11:22:33
sudo tcpdump -i eth1 -w /tmp/capture.pcap
sudo tcpdump -i eth1 icmp -c 4
sudo tcpdump -i eth1 icmp -C 10 -w /tmp/capture.pcap