Search code examples
tcpclient-servertcpdump

capturing tcp packets via tcpdump


I'm trying to capture tcp packets from a GPS device(client) configured to my server's 11050 port of eth1 interface. I wanna capture these packets to a file. The result is not in a human readable format. Below are list of the commands i tried with, but no results. please help...

tcpdump -w test.pcap -i eth1 tcp port 11050

tcpdump -i eth1 -X -s 11050 -w test1

test1, test.pcap both read the below!!!

  ��ق���ق���ʣ�N�%��S�U$��E�MO@5�&߶y?vf��6++�qe��>ۀ  

Solution

  • tcpdump will write the captured data in a format suitable for re-parsing later with tcpdump, wireshark, Tshark, etc.

    Re-read the file with tcpdump -r test.pcap and you'll get human-readable output:

    $ tcpdump -r ./test.pcap 
    reading from file ./test.pcap, link-type EN10MB (Ethernet)
    23:25:32.646075 ARP, Request who-has moxi-00067F274580 tell haig, length 28
    23:25:32.646322 ARP, Reply moxi-00067F274580 is-at 00:06:7f:27:45:80 (oui Unknown), length 46
    23:25:34.567932 IP haig.36941 > 192.168.0.1.domain: 36648+ A? www.google.com. (32)
    ...