After installing, check if tcpdump is installed successfully executing the below command
Should return the binary location of the package installed
After confirming you can run tcpdump with various options passing to the command to check for the options
[root@ashwin ~]# tcpdump –help
tcpdump version 3.9.8
libpcap version 0.9.8
Usage: tcpdump [-aAdDeflLnNOpqRStuUvxX] [-c count] [ -C file_size ]
[ -E algo:secret ] [ -F file ] [ -i interface ] [ -M secret ]
[ -r file ] [ -s snaplen ] [ -T type ] [ -w file ]
[ -W filecount ] [ -y datalinktype ] [ -Z user ]
[ expression ]
We will be capturing packets for 2 minutes and analyze for any issues with hosts connecting to and from.
Running the below command will capture all the packets transferring between the hosts through the Network Interface Cards and will be redirected to a file
tcpdump -n -i bond0 -e -vvv > output.log
I am assuming you are using eth0, -n turns off DNS.
tcpdump -i eth0 -n port 80
Now a little more fancy, using egrep – this will show all your web requests in real time!
tcpdump -i eth0 -A -n port 80 | egrep -i \(GET.\/\|POST.\/\|Host:\)
Did you know you can tcpdump for a subnet by just excluding the last octet?
tcpdump -i eth0 -n port 80 and host 10.0.5
You can see I used ‘and’ here to specify more filter, you can also use or
If you forgot your pop3 password, but have it stored in the client
tcpdump -i eth0 -n port 110 -A | egrep -i \(user\|pass\)
This also applies to passwords for the web, I have used this a lot instead of the ‘forgot password’ mechanism.