In this tutorial we will cover why Windows ping uses IPv6 by default and how to force ping to use IPv4. Our article applies to Windows 11 and supported Windows Server versions (2019/2022/2025).
Why Does Ping Return IPv6 Instead of IPv4?
In Windows, when you ping a remote computer on your LAN by its hostname or ping a localhost, the command may return an IPv6 address instead of its an IPv4 address. This is because modern Windows versions prefer IPv6 over IPv4 when both protocols are available and reachable. By default, the ping command uses the IPv6 address if a hostname resolves to both IPv6 and IPv4 addresses:
ping DESKTOP-V79DK27
Pinging DESKTOP-V79DK27.local [fe80::cd84:26d9:6b40:339b%13] with 32 bytes of data:

How to Force a Ping Response with an IPv4 Address in Windows
If you want the ping command to use the IPv4 address of a remote device, you can force it to use that specific protocol. To force ping to use IPv4, use the -4 option before the hostname:
ping -4 DESKTOP-V79DK27
Pinging DESKTOP-V79DK27.localdomain [192.168.158.144] with 32 bytes of data:
Reply from 192.168.158.144: bytes=32 time<1ms TTL=128
When you use the Resolve-DnsName PowerShell command to lookup an IP address for a specific hostname, both IPv6 (AAAA type record) and IPv4 (A type record) addresses are returned:
Resolve-DnsName DESKTOP-V79DK27|select name, IPAddress, Type
Because the IPv6 protocol is preferred, Windows by default uses the IPv6 host address for connections.

Best practice recommendation
Keep IPv6 enabled and prefer it by default. You should use explicit IPv4 selection for individual tests/apps unless there is a validated requirement to change the system-wide address-selection policy.

Prefix Policy Precedence on Windows
In Windows, the Prefix Policy Precedence is used to determine the priority of IP protocol versions when both an IPv4 and an IPv6 address are available for a remote host.
Run the following command to view the current prefix policy table in Windows:
netsh interface ipv6 show prefixpolicies

Or use PowerShell command to list prefix policy table:
Get-NetPrefixPolicy

Default Windows Prefix Policy
Note that the effective prefix policy can vary by Windows version and system config. Don’t forget to check the current policy on the affected machine before troubleshooting/changing it.
| Precedence | Label | Prefix | Description |
| 50 | 0 | ::1/128 | IPv6 loopback |
| 40 | 1 | ::/0 | Native IPv6 |
| 35 | 4 | ::ffff:0:0/96 | IPv4 |
| 30 | 2 | 2002::/16 | 6to4 |
| 5 | 5 | 2001::/32 | Teredo |
| 3 | 13 | fc00::/7 | Unique-Local addresses, ULAs |
| 1 | 11 | fec0::/10 | site-local |
| 1 | 12 | 3ffe::/16 | 6bone |
| 1 | 3 | ::/96 | IPv4compat |
If both IPv4 and IPv6 addresses are available for the remote hostname, Windows uses this prefix table to determine which address to use for the connection. A protocol with a higher Precedence value in this table has a higher priority. By default, the policy 40 ::/0 (Native IPv6) takes precedence over 35 ::ffff:0:0/96 (IPv4-mapped addresses). This means that Windows will generally prefer native IPv6 addresses when both IPv6 and IPv4 destinations are available and reachable. This behavior follows RFC 6724 address selection rules used by modern Windows versions.
You can enable the โPrefer IPv4 over IPv6โ option in prefix policies.
Advanced: Prefer IPv4 over IPv6
If you have a validated compatibility/troubleshooting requirement to prefer IPv4, run the following command from an elevated Command Prompt:
netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 45 4
Important. You should use a precedence value above the native IPv6 precedence of 40 but below the IPv6 loopback precedence of 50. The value 45 makes IPv4-mapped addresses preferred over native IPv6 destinations without taking precedence over the ::1/128 loopback entry.
Check new IP protocol priority settings (the IPv4 protocol is now higher in the stack):
netsh interface ipv6 show prefixpolicies
Since store=persistent is used by default, the new prefix policy remains in effect after a reboot.

This changes the Windows address selection policy to prefer IPv4-mapped addresses over native IPv6 addresses for new outbound connections. Existing connections are not automatically switched to IPv4. If you are testing an app, you need to establish a new connection after changing the policy.
Pinging srv01.contoso.com [192.168.10.21] with 32 bytes of data
Reply from 192.168.10.21: bytes=32 time<1ms TTL=128

After changing the address-selection policy, you should test both protocols explicitly and then test the hostname without a protocol override:
ping -4 srv01.contoso.com
ping -6 srv01.contoso.com
ping srv01.contoso.com
For app-level connectivity, you need to test the TCP port used by the service:
Test-NetConnection srv01.contoso.com -Port 443
In order to restore the default Windows behavior (prefer IPv6 over IPv4), reset the IPv4-mapped precedence value back to the default:
netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 35 4
The command above restores the default Windows precedence value for IPv4-mapped addresses.
In some managed enterprise environments, you may choose to config the DisabledComponents registry parameter to prefer IPv4 over IPv6 system-wide. You can modify or create the DisabledComponents registry parameter under HKLM\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters with a value 0x20:
reg.exe add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents /t REG_DWORD /d 0x20 /f
Keep in mind that DisabledComponents=0x20 does not disable IPv6. This setting only changes Windows address selection preference to favor IPv4 over IPv6. Don’t forget to restart the machine after applying this registry change.

This registry key can be deployed to multiple domain-joined computers via Group Policy.

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.

Hint. To restore the Windows default behavior, remove the DisabledComponents registry value and restart Windows (in case the value is not present, Windows uses its default IPv6 config):
reg.exe delete HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents /f
Why does ping return an IPv6 address instead of IPv4 in Windows?
Modern Windows versions prefer IPv6 over IPv4 when both protocols are available. If a hostname resolves to both AAAA (IPv6) and A (IPv4) DNS records, the ping command will usually use the IPv6 address first according to RFC 6724 address selection rules.
Is it safe to modify IPv6 prefix precedence?
Usually no. Modifying prefix precedence affects the entire Windows TCP/IP stack, not just the ping command.
Incorrect configuration can cause issues with:
- Microsoft 365
- Exchange Hybrid
- DirectAccess
- Always On VPN
- WinHTTP/WinINET applications
- Modern authentication
- Dual-stack enterprise networks
For most troubleshooting cases, use ping -4 instead.
Does modifying prefix precedence disable IPv6?
No. It only changes address selection preference.ย IPv6 remains enabled and operational unless explicitly disabled separately.
Does DisabledComponents=0x20 disable IPv6?
No. The 0x20 value only changes protocol preference to prefer IPv4 over IPv6. It does not disable IPv6 functionality.
Does changing DisabledComponents affect the IPv6 checkbox on the network adapter?
No. The IPv6 checkbox in the network adapter properties remains enabled. This is expected behavior.
Should I disable IPv6 if I only use IPv4?
Microsoft does not recommend disabling IPv6 completely. Many Windows components and enterprise applications rely on IPv6 internally, even in IPv4-only environments.
Disabling IPv6 may cause unexpected issues with:
- Windows networking
- Microsoft 365
- Exchange
- VPN connectivity
- Modern authentication
- Windows services

Thank you so much, I keep this article with my toolbox, very helpful, it helped me a lot.
We? As a small non profit company that have 20 staff member in most of our offices , we do not need IPv6.