Starting with Windows Vista and Server 2008, IPv6 is the default over IPv4. This can be annoying if your enterprise network isn’t prepared to support this. You can modify this default behavior by OR’ing and registry setting on your machine.

The registry setting is the DisabledComponents registry value and it controls a series of bit flags as defined below:

  • Bit 0 Set to 1 to disable all IPv6 tunnel interfaces, including ISATAP, 6to4, and Teredo tunnels. Default value is 0
  • Bit 1 Set to 1 to disable all 6to4-based interfaces. Default value is 0
  • Bit 2 Set to 1 to disable all ISATAP-based interfaces. Default value is 0
  • Bit 3 Set to 1 to disable all Teredo-based interfaces. Default value is 0
  • Bit 4 Set to 1 to disable IPv6 over all non-tunnel interfaces, including LAN interfaces and Point-to-Point Protocol (PPP)-based interfaces. Default value is 0
  • Bit 5 Set to 1 to modify the default prefix policy table to prefer IPv4 to IPv6 when attempting connections. Default value is 0

 

Note Bits beyond Bit 5 are not used at this time

 

A single byte consists of 8 bits, these bits can have a value of 1 or 0.  In the DisabledComponents instance each of the first five bits refer to a switch, with 1 being on a 0 being off.  This can also be thought of as either true/false or on/off.

The zero bit refers to 0 or 1 The one bit refers to 0 or 2 The two bit refers to 0 or 4 The three bit refers to 0 or 8 The four bit refers to 0 or 16 The five bit refers to 0 or 32 The six bit refers to 0 or 64 The seven bit refers to 0 or 128

If you add all the bits up when set to a one the maximum value is 255.  Why do I bring this up?  In order to modify a bit you need to not modify the bits around it.  So first off you realize that the last three bits aren’t used so the maximum value will be – 1 + 2 + 4 + 8 + 16 + 0 + 0 + 0 = 31.  So the largest this key can ever be (Barring disabling IPv6 which will be set to the DWord of 0xFFFFFFFF).

So on to setting the default of IPv4 over IPv6 is to examine the fifth bit if it is zero then you need to modify the value by adding 16.  If the current value is equal to or greater than 16 than you know that the fifth bit is already set.

To take an example:

If the key is equal to 10, then you can see that:

  • 6to4-based interfaces is disabled
  • Teredo-based interfaces is disabled

By adding (Or’ing 00010000) 16 to the key you end up with 26 which says, bits 1, 3 and 4 are all set to a 1 (Or are true).

For additional details refer to the technet article: http://technet.microsoft.com/en-us/library/bb878057.aspx

I have a seperate Blog on disabling IPv6 http://blogs.dirteam.com/blogs/paulbergson/archive/2009/03/19/disabling-ipv6-on-windows-2008.aspx