A Step-by-Step Guide to Prioritizing IPv4 over IPv6 in Windows Networks

By default, Windows attempts to connect to remote hosts using IPv6 if both IPv4 and IPv6 addresses are available. This occurs when the DNS server or mDNS method returns both ‘AAAA’ (for IPv6) and ‘A’ (for IPv4) records. Such behavior may become problematic for network services or older applications that don’t support IPv6 or don’t listen on that network interface. To address this, you can set Windows to prioritize IPv4 over IPv6.

For instance, in a workgroup local network without a DNS server, broadcasting might be utilized for name resolution through the built-in mDNS protocol. You can verify the records and addresses being returned by executing:

Resolve-DnsName DESKTOP-ABCD1234

This command should yield both IPv6 and IPv4 records. You can then check which protocol Windows is using by default by doing a simple ping. If it returns the IPv6 address instead of the IPv4 one, you will need to adjust the default protocol preference.

It’s not advisable to completely disable IPv6 as this could lead to problems with various network services and applications. To view your current IPv6 prefix policy settings that dictate the address usage priority, use:

netsh interface ipv6 show prefixpolicies

or

Get-NetPrefixPolicy

To modify the prefix policy so that IPv4 addresses take precedence, you can run:

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

This setup enhances IPv4 protocol preference without entirely disabling IPv6, avoiding the need for a system reboot. After setting the preferences, attempt to ping the remote host again. This time, the resolution should return the IPv4 address, confirming the new settings.

Another approach to prioritize IPv4 over IPv6 is through the Windows Registry. Navigate to the registry key:

HKLMSYSTEMCurrentControlSetServicesTcpip6Parameters

Create a new REG_DWORD entry named DisabledComponents with a value of 0x20. Restarting the computer will apply the changes. You can execute this command directly from the command prompt as well:

reg add HKLMsystemcurrentcontrolsetservicestcpip6parameters /v DisabledComponents /t REG_DWORD /d 0x20

If you wish to revert to the original settings where IPv6 is preferred, use:

reg add hklmsystemcurrentcontrolsetservicestcpip6parameters /v DisabledComponents /t REG_DWORD /d 0x0

To implement this registry change across all computers in a domain, you can deploy the registry setting using Group Policy Preferences.


Posted

in

, ,

by

Tags: