How to Use the Ping Command to Ping IPv4 or IPv6

Here’s a useful tidbit relating to ping on Windows: If you specify -4 or -6 after the IP address or hostname, you can ping either IPv4 or IPv6, respectively. For example:

To ping using IPv4:

  ping -4

To ping using IPv6:

  ping -6

Additionally, if you add an entry to your hosts file (C:\Windows\System32\drivers\etc\hosts), ping‘s default behavior will change from IPv6 to IPv4.