This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Difference between using src and dst in tcpdump commands

0

Hi,

Could you please explain the difference between working nature of below two commands.

tcpdump -w xpackets2.pcap -i eth0 src host-name

tcpdump -w xpackets2.pcap -i eth0 dst host-name

Thanks in advance.

asked 24 Dec '13, 01:23

Manivas's gravatar image

Manivas
1222
accept rate: 0%

i telnet to the particular ip address from putty and executing some commands on that. I need to capture the packets for both sending commands to that particular ip address from putty and responses from that same ip address for these commands.

So could you please suggest the tcpdump commands to work for this.

Thanks in advance.

(24 Dec '13, 01:56) Manivas

One Answer:

0

Using a capture filter of 'src host-name' limits the captured packets to those originating from host-name. Similarly 'dst host-name' limits packets to those going to host-name.

To capture both types of packets you need to use a filter of 'host host-name'.

answered 24 Dec '13, 12:19

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Hi Thanks,

You are suggesting that to capture packets sending to particular ip address and receiving from that same particular ip address in linux machine, we need to use the command like below.

"tcpdump -w xpackets2.pcap -i eth0 host host-name"

(26 Dec '13, 05:38) Manivas

Sure, replacing the "host-name" part with the IP address of interest.

See the first example on the Wireshark Capture Filters Wiki page.

(26 Dec '13, 06:39) grahamb ♦