Since Windows Vista, and continuing in Windows 7, Windows 8 and Windows 10, Windows operating systems prefer IPv6 protocol, which takes precedence over the commonly used standard IPv4 protocol. As the result, pinging a remote host on the same network, VLAN or subnet, or even localhost, may return IP address in IPv6 style.

For example,

> ping hostname

Pinging hostname [fe80::4016:fe2b:ba1e:ffd2%10] with 32 bytes of data:
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=2ms
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=5ms
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=1ms
Reply from fe80::8016:fe2b:ba1e:ffd2%10: time=3ms

Ping statistics for fe80::8016:fe2b:ba1e:ffd2%10:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 1ms, Maximum = 5ms, Average = 3ms

If you’re using ping command and want it to return IPv4 address, you can always use the option provided by ping to force ping to use IPv4 address. But some other programs or applications may not be able to use IPv6 address and yet unable to force use of IPv4 address, causing problems and issues with their normal operations.

In such cases, it’s possible to change the Windows preference for Internet Protocol, that’s by increasing the priority of IPv4 over the IPv6 protocol so that IPv4 always takes precedence over IPv6. Doing so does not disable IPv6, allowing IPv6 protocol to continue functioning.

Here’s how to change the priority of IPv6 protocol:

  1. Open elevated Command Prompt.
  2. Run the following commands:
    netsh interface ipv6 set prefix ::/96 60 3
    netsh interface ipv6 set prefix ::ffff:0:0/96 55 4

The change takes effect immediately and no system restart required. Note that you have to perform the above operation on system or server that you want it to return IPv4 instead of IPv6 by default. Both IPv4 and IPv6 addresses could be used and work properly after the switch.

The commands above are actually modifying the e prefix policies of IPv6. The changed settings modify precedence of the IPv4 compatibility priority so that IPv4 is preferred, even when IPv6 is available.

You can use the following command to query the current IPv6’s prefix policies:

netsh interface ipv6 show prefixpolicies

It should returns similar to the following?

Querying active state...

Precedence  Label  Prefix
----------  -----  --------------------------------
        50      0  ::1/128
        40      1  ::/0
        30      2  2002::/16
        20      3  ::/96
        10      4  ::ffff:0:0/96
         5      5  2001::/32

As seemed from the result above, the change prefix commands modifies the precedence for label 3 and label 4 of IPv6 prefix policies, which representing the IPv4 compatibility listings. The commands actually increase the the IPv4 compatibility precedence (label 3 and label 4) to 60 and 55 respectively, so that it’s higher than label 0 (the localhost address) and is preferred, and the traditional IP address is returned instead of IPv6 address.