Random notes about setting up Windows Systems
IPv6 protocol preferences
Sometimes the windows systems here have problems with the IPv6 network setup, which has multiple networks assigned via rad, one dynamic from the ISP and one which is a Hurricane Electric IPv6 tunnel.
Contacting Microsoft services often times out or fails because IPv6 is the preferred way to communicate in Windows 10 and above:
PS C:\WINDOWS\system32> netsh interface ipv6 show prefixpolicies
Querying active state...
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
As one can see the precedence of IPv6 connections (::/0) is higher than the
one of IPv4 connections (::ffff:0:0/96). So there are two possible solutions
for this:
- Use a proxy, thus letting the proxy decide how to contact the endpoint of the HTTP request.
- Change the precedence of the IPv4 connections to be above the IPv6 ones
I decided to go with option two:
netsh interface ipv6 set prefixpolicy prefix=::1/128 precedence=50 label=0
netsh interface ipv6 set prefixpolicy prefix=::ffff:0:0/96 precedence=45 label=4
netsh interface ipv6 set prefixpolicy prefix=::/0 precedence=40 label=1
netsh interface ipv6 set prefixpolicy prefix=2002::/16 precedence= label=2
netsh interface ipv6 set prefixpolicy prefix=2001::/32 precedence= label=5
netsh interface ipv6 set prefixpolicy prefix=fc00::/7 precedence= label=13
netsh interface ipv6 set prefixpolicy prefix=fec0::/10 precedence=1 label=11
netsh interface ipv6 set prefixpolicy prefix=3ffe::/16 precedence=1 label=12
netsh interface ipv6 set prefixpolicy prefix=::/96 precedence=1 label=3
Which sets the IPv4 connections at second place in the hirachy.
Note: All policies must be set as after a reboot the table will only contain the policies activly set.
To revert the change just turn it back to the previous value:
netsh interface ipv6 set prefix ::ffff:0:0/96 35 4
Or if there are other changes to revert:
netsh interface ipv6 reset
Note: A reboot is required if the reset method above is used.
Use the registry to prefer IPv4 over IPv6
According to the microsoft
documentation
the registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\DisabledComponents
may be used to disable various usages of IPv6 in the system and prefer IPv4
instead.