0

Is there a flag or other utility (perhaps tcpdump?) that can be used to see the outgoing packets that are sent via the ping utility? For example:

$ ping -c 5 google.com
PING google.com (172.217.14.78): 56 data bytes
64 bytes from 172.217.14.78: icmp_seq=0 ttl=53 time=1.244 ms
64 bytes from 172.217.14.78: icmp_seq=1 ttl=53 time=1.298 ms
64 bytes from 172.217.14.78: icmp_seq=2 ttl=53 time=1.195 ms
64 bytes from 172.217.14.78: icmp_seq=3 ttl=53 time=1.283 ms
64 bytes from 172.217.14.78: icmp_seq=4 ttl=53 time=1.322 ms

--- google.com ping statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 1.195/1.268/1.322/0.045 ms

For example, how can I see those 5 packets that are sent to Google (for example, in hex output)?

1

First listen with tcpdump :

$ sudo tcpdump -c 10 -vvv -XX -i any icmp
  • -c 10 = Exit after receiving 10 packets (5 requests and 5 replies) = ping -c 5.
  • -vvv = Even more verbose output.
  • -XX = Print in hex and ASCII.
  • -i any = all interfaces
  • icmp = Internet Control Message Protocol (ICMP)

Next, open a new terminal :

$ ping -c 5 google.com

Check for "ICMP echo request"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.