Prefer IPv4 over IPv6 on Windows

When trying to get rid of IPv6 for good or mostly bad read reasons, most searches on the Internet will link to KB article 929852 when it comes to prefer IPv4 over IPv6.

Basically, you must update under HKLM\System\currentcontrolset\services\tcpip6\parameters, the DisabledComponents key and use a value of 20.

However this method has two drawbacks:

  • it requires you to reboot the computer
  • there is no built-in GPO to do this, however this post has the admx files to do this.

An alternate method is to use the IPv6 prefix policies which defines which IPv6 prefixes are used preferably when sending packets. There you can choose if your settings are valid until the next reboot or are persistent across them.

On a standard Windows 2008R2, the prefix policy is as follows:

Windows Default IPv6 Prefix PolicyHere the IPv6 addresses are preferred as ::/0 has a precedence of 40, just after the localhost ::1 entry. As you see at any time you can get the current state with netsh interface ipv6 show prefixpolicies.

To have IPv4 favored over IPv6, you must enter a command like netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4 which will make IPv4 addresses have a precedence of 46. By default the entry is msade persistent across reboots as opposed to good old route utliity under IPv4.

By the way, if you’re lost in IPv6, the multiple RFCs which supersede each other, how IPv4 addresses are written in IPv6 language, there is a nice cheat sheet here by Jens Roesen.


Leave a comment

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.