Friday, October 25, 2019

Why is the default for the `ping` command to use both IPv4 and IPv6?

I noticed on Wireshark that I will sometimes see both ICMP and ICMPv6 ECHO requests/replies while pinging different destinations. (ex: ping -c 10 destname).

While I understand I can specify a protocol, I'm curious if there exist any reasons someone would want the default over choosing just one.

I've looked at (what I believe to be) the source code for iputils' ping program (github link). To my understanding, both are used if both can be, else "falling back" to IPv4. This leads me to suspect that the default is both protocols because it's 1) a reasonable default and 2) cleaner logic to start with both protocols enabled.

That being said, I still don't know if there's a reason to specifically test the default or whether or not v4/v6 is chosen 'randomly' by ping. If anybody would like to share any insight, I'd greatly appreciate it!



No comments:

Post a Comment