Use tcpdump to capture an ICMP destination unreachable message

linux-networkingtcpdump

I am new in this area. I am asked to use tcpdump to capture an ICMP destination unreachable message in my network course.
So I am trying to capture one message that is an ICMP destination unreachable and whose destination IP is dst 172.17.1.8. My code is following:

sudo tcpdump -c 1 'icmp[0] = 3' and dst 172.17.1.8

It shows "tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
"

The problem is, in order to capture the unreachable message, some packets need to be sent to this IP address first. I have tried ping 2 packets to that destination before the code. However, the code won't be executed until the ping is done. So still I can't receive the unreachable message by using tcpdump.

Thank you.

Best Answer

You can run several commands at once, for example with several command windows. Start tcpdump in one window, then ping in the other window, stop the ping command after a few pings, and then stop tcpdump.

Related Topic