Ping Returns IPv6 Address Instead of IPv4

If your computer and a remote device are located on the same IP network, VLAN, or subnet — you will probably notice that if you ping such a device by its hostname it will return an IPv6 address. For example, we will try to ping a Windows Server host on our network with the command:

Ping srv01

Pinging [fe80::c09::d4e6::189f::f661%3] with 32 bytes of data

Reply from fe80::c09::d4e6:189f:f661%3: time<1ms

Reply from fe80::c09::d4e6:189f:f661%3: time<1ms

ping ipv4

As you can see, the ping command returned an IPv6 host address instead of an IPv4 one.

Ping Returning an IPv6 Address Instead of IPv4

The fact is that the IPv6 protocol is the preferred protocol over IPv4 in modern Windows editions (and even in Linux).


If you still want to see an IPv4 address of a remote device in the ping command result, then simply use the command below:

ping hostname -4

Simply add a parameter “-4” after your usual ping command:

Ping srv01 -4

Pinging [] with 32 bytes of data

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

ping ip4

As you can see, the ping command returned the standard IPv4 address.

How to Force Windows to Use IPv4 Over IPv6?

In all versions of Windows starting from Vista, IPv6 global unicast addresses are preferred over IPv4 addresses (according to the RFC 3484). Windows normally prefers using IPv6 over IPv4 if IPv6 is enabled on the local system.

Internet Protocol version 6 (IPv6) is a mandatory part of Windows. If you disable it, some Windows components may not work properly. Microsoft recommends using the option “Preferably use IPv4 instead of IPv6” in Windows prefix policies instead of completely disabling IPv6.

If the client tries to access a remote server using an ICMP protocol (ping, telnet, or pathping commands), and it returns the IPv6 address (or there are some problems with the operation of some legacy applications) there is a more advanced solution.

The solution is to increase the priority of the IPv4 over the IPv6 protocol. You can use such a solution without the need to completely disable the IPv6 on a source and the target host.

To display the current policy table on Windows, run the following command:

netsh interface ipv6 show prefixpolicies

ping force ipv4

The following prefix policy settings are used by default on Windows 10/11 and Windows Server 2019/2016.


Precedence Label Prefix

———- —– ——————————–

50 0 ::1/128

40 1 ::/0

35 4 ::ffff:0:0/96

30 2 2002::/16

5 5 2001::/32

3 13 fc00::/7

1 11 fec0::/10

1 12 3ffe::/16

1 3 ::/96

The prefix policy table is similar to the routing table. It determines which IP addresses are preferred when establishing a remote connection. Windows uses this prefix table to determine which address to use, then multiple addresses are available for the hostname (IPv4 and IPv6 in this case).

In this table, the policy “1 ::/0” (Native IPv6) takes precedence over “::ffff:0:0/96” (IPv4). A protocol with a higher Precedence value in this table has a higher priority. By default, the ::ffff:0:0/96 prefix has a lower priority than ::0 which means IPv6 is preferred over IPv4 on this Windows host.

Prefer IPv4 over IPv6 on Windows

The solution doesn’t require a reboot, it takes effect immediately. You need to open an elevated Command Prompt, and run 2 commands:

netsh interface ipv6 set prefix ::/96 60 3

netsh interface ipv6 set prefix ::ffff:0:0/96 55 4

These commands increased the priority of the IPv4 prefix policy and decreased the priority for IPv6. By default, this change is made persistent across reboots.

For example, run these two commands on a clean Windows Server 2016 host, and run a ping request again:

Pinging [] with 32 bytes of data

Reply from bytes=32 time<1ms TTL=128

Reply from bytes=32 time<1ms TTL=128

cmd ping ipv4

As you can see, the result changed dramatically in the direction we needed. The remote server began to return an IPv4 address ( instead of an IPv6 address. Now we’ll check that the server is still pinging by its IPv6 address, and we didn’t break anything:

ping fe80::c09::d4e6:189f:f661%3

ping ipv4 only

Everything works as it should be.

Print the current prefix priority table:

netsh interface ipv6 show prefixpolicies

As you can see, IPv4 is now used by default when sending the network packets.

windows ping ipv4

In order to make this change permanent, you can change or create the DisabledComponents registry parameter with a value 0x20, which will tell Windows to always prefer IPv4 over IPv6 (see below).

You can also change the preferred IP protocol from GUI. To do it, open Control Panel > Network and Internet > Network Connections > Advanced > Advanced Settings.

ping ipv4 cmd


Select your network connection, and set the IPv4 protocol above IPv6 with the green button. You should perform this operation for all available bindings.

ping ip v4

Tip. The “Adapters and Bindings” dialog box is missing in the newest Windows 10/11and Windows Server 2016/2019.

Another way to change the default TCP/IP stack from IPv6 to IPv4 on these OSs is through the registry. The IPv6 functionality can be configured in Windows by modifying the DisabledComponents registry parameter HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters.

Open the elevated command prompt and run the command:

reg.exe add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents /t REG_DWORD /d 0x20 /f

ping with ipv4

Or you can change the value of the DisabledComponents to 0x20 via the Regedit.exe GUI. This value allows you to prefer an IPv4 protocol over IPv6 by changing entries in the prefix policy table. Reboot your computer for the changes to take effect.

You can use Group Policy Preferences to deploy this registry key to multiple computers in an Active Directory domain using a GPO.

ping ipv4 windows

After that, IPv6 Functionality will change to “Prefer IPv4 over IPv6” policies. Microsoft recommends using this policy instead of disabling IPv6 on the host.

Hint. To return to Windows default behavior (prefer IPv6 over IPv4), run the command:

reg add hklm\system\currentcontrolset\services\tcpip6\parameters /v DisabledComponents /t REG_DWORD /d 0x0

Other possible values for the DisabledComponents parameter:

IPv6 Functionality

DisabledComponents registry value

Disable IPv6 protocol


Prefer IPv4 over IPv6


Disable IPv6 on all nontunnel interfaces


Disable IPv6 on all tunnel interfaces


Disable IPv6 on all nontunnel interfaces (except the loopback) and on IPv6 tunnel interface


Default value


Note that the value of this registry parameter doesn’t affect the IPv6 checkbox in the properties of the network adapter. This is expected behavior.

ping v4

Brian Jackson started this blog in 2011. Brian has a huge passion for WordPress and technology for over a decade. Brian enjoys blogging, movies, and hiking.


  1. is there a way to change it so that it responds on IPv4, by default? I don’t want to disable IPv6, but do not want to use it at all

    1. If you are not using IPv6 there is no reason to have it enabled. To disable it, go to Network Connections, right click Properties on your NIC and then uncheck “Internet Protocol Version 6 (TCP/IPv6).
      Hope that helps! There is no way unfortunately to default to IPv4 like in command prompt.

      1. Unchecking the protocol binding is not sufficient to disable IPv6. It will seem to work at first, but you will eventually run into strange network problems that seem to defy any explanation. This is ESPECIALLY true for servers. To properly disable IPv6, see KB929852. The “Fix It” MSI available from this KB article is suitable for GPO deployment, no need to create a custom ADMX.

      2. That does not disable IPv6 totally. You can do the following to disable it totally: Create a DWORD entry named DisabledComponents in HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpip6Parameters and give it the value 0xffffffff

        Abdeslam Mazouz
        Network Security

  2. hell yeah…

    Thank you dude! Helped me very much right now!!
    Till now i had to disable ipv6, reboot and at least but not last change the computername (in a automated tailoring of my system). Now i can rename after disabling, without a reboot!

    Thank you (again)


  3. There is a easier method that works for me. I just changed the interface metric # to determine its priority. I had used this method in the past to change priority of network adapters (Wireless NIC priority first, LAN NIC priority second), but I found out it works on TCP/IPv4 and TCP/IPv6 as well. In this case, I changed the interface metric of TCP/IPv4 from Automatic to 5, and TCP/IPv6 interface metric from Automatic to 10. The lower the metric number, the higher its priority. Then restart your PC. So now whenever I ping using the hostname, it will reply from IPv4, instead of Ipv6.

  4. Well sh!t. How would you know.

    This helped sort an (yet another) issue with MSDTC between 2 clusters (linked servers)

    So thank you so very much!.

  5. In my environment (1 windows server 2008 R2 domain controller with Windows 7 pro and Windows 10 Pro client computers) was having the following issues:
    *Pinging the server by hostname on the server itself returned only ipv6 response (ipv6 disabled)
    *Pinging a Windows 10 client pc by hostname or ip address from the server timed out
    *Windows 10 client pc’s would lose drive mappings to server; would need to manually re-connect mapped drives and enter credentials to access data
    *Running the 2 Netsh commands resolved all issues and network, server and clients all performing normally ;)
    *Elegant and simple fix- Thanks!!

  6. After doing that I see ::/96 at the top of the list and ::ffff:0:0/96 second. I ping the local computer by name and resolves to the IPv4 address. However, I reboot and ping is back to IPv6 address even though the ONLY entries in the table are now ::/96 and ::ffff:0:0/96 (netsh interface ipv6 show prefixpolicies). My problem is that some software installs a Tomcat webserver and attempting to connect to it on the same computer does not work. If I keep manually replacing the computer name in the URL with localhost, I eventually get to the login screen but the integral UAA login is expecting ComputerName.admin and is just not working. Exact same setup works on a Windows 7 computer.

  7. I have tested this commands on many PCs in my environment and it works but on my pc don’t.
    After setted prefix to prefer ipv4 with dos command it continue to ping ipv6 address.
    The prefix is the following and seems to be correct:
    60 3 ::/96
    55 4 ::ffff:0:0/96
    I have the regedit voice setted too but it pings ipv6.
    Any ideas?


  8. We should *not* be disabling IPv6 these days. We should be enabling it, configuring it, using it, and then turning off legacy IPv4 wherever it is not needed.

    IPv6 is in wide use now. Google, Facebook, Comcast, and many others, including pretty much all cellphone carriers use IPv6. In fact, over 50% of all Facebook’s US traffic is now IPv6, and over 30% of Google’s worldwide traffic is IPv6.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.