18

We tried installing a 3rd party software product on a new Windows Server 2008 R2 machine and found that everything works except for accessing local services through loopback addresses such as localhost or the computer name (ex: VPS-Web which resolves to localhost). We are not using IPv6 and would like to disable it until the software is compatible.

I tried using these instructions for disabling IPv6 on Windows 2008 R2 but it did not disable the protocol for localhost. Pinging localhost or VPS-Web will still return ::1: instead of 127.0.0.1. I can use ping localhost -4 to get the correct address, but IPv6 takes precedence over IPv4 so the 3rd party software only gets the IPv6 address.

2
  • Have you tried contacting the vendor to see if they have a workaround? Ping requests IPv6 address, hence it will get ::1, applications that don't support IPv6 wont get those addresses though.
    – Chris S
    Jan 4, 2011 at 21:49
  • The software is an abomination of various components (JAVA, Tomcat, Apache, MSSQL, SAP, JDBC, WMI) any one of which could be the problem. I'm not using IPv6, so I'd like to disable it. Also it concerns me that there does not appear to be an option to do this for the loopback adapter.
    – Greg Bray
    Jan 5, 2011 at 0:22

6 Answers 6

14

I had initially checked the host file as SilverbackNet suggested, but on a Windows 2008 R2 server this is the default file:

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

# indicates a comment in the host file, so all the entries are commented out, and the first line is a bit confusing. I then noticed that there were two entries for localhost that were commented out, so I tried uncommenting the IPv4 one and it worked! I should have tried that first but I was thrown off track by the first line. Using the below host file pinging the computer name or localhost will always return an IPv4 address, which fixes the problem with the 3rd party software!

# localhost name resolution is handled within DNS itself.
#   ::1         localhost
127.0.0.1       localhost
127.0.0.1       VPS-Web
4
  • Did this remove the ipv6([::]) listening in netstat? Mar 24, 2013 at 1:52
  • It does not. [::] is the IPv6 equivalent of 0.0.0.0, which represents all available IP addresses on the system. The above fix is specifically for the localhost loopback address. I have both the above settings as well as the DisabledComponents=0xffffffff registry key and I still see applications listening on [::]. I don't know if there is any way to fully disable IPv6.
    – Greg Bray
    Mar 25, 2013 at 16:14
  • Thanks for confirming my problem! I was just making sure :) Mar 26, 2013 at 22:20
  • 2
    This didn't work for me. I flushed dns cache and rebooted, but it still returns an IPv6 address...
    – red-o-alf
    Dec 13, 2019 at 11:46
5

Setting "DisabledComponents" = 0x20 under

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\

will set that machine to use IPv4 instead of IPv6 in prefix policies.

Create the registry key if it doesn't exist.

3

The initial ServerFault thread about using the DisabledComponents registry value is really the best way to do this. Hosts file tweaking should never be necessary in a well functioning network. The registry tweak is also much easier to deploy and revert via group policy if you have an Active Directory.

The reason it didn't work is because that DisabledComponents registry setting is read as a set of bit flags and not simply on or off. Here is the official documentation from Microsoft on the subject:
How to disable IP version 6 (IPv6) or its specific components in Windows 7, in Windows Vista, in Windows Server 2008 R2, and in Windows Server 2008

The short version is that to completely disable IPv6 on Vista/2008 and beyond, set the value of DisabledComponents to 0xff. I do this on every machine I manage where we're not explicitly using IPv6. It has the nice side effect of significantly shortening the output of the ipconfig command.

6
  • 2
    According to your link (support.microsoft.com/kb/929852#letmefixit) this registry entry allows to disable IPv6 in many places EXCEPT loopback...
    – Frank N
    Jan 28, 2013 at 16:47
  • 1
    You are correct. However, there are values that change the default network functionality to prefer IPv4 over IPv6 which will effectively solve the OP's problems with connecting to localhost or the NetBIOS computer name. Jan 28, 2013 at 19:00
  • None of these have actually worked for me in Windows Server 2012R2. This includes trying hosts modification, DisabledComponents registry setting in addition to many other ideas I've seen elsewhere. Works on Windows Server 2008 but I have no solution for 2012R2. Jun 23, 2015 at 15:09
  • You need to reboot after modifying the DisabledComponents value. If you've set it to 0xffffffff, there is no way it didn't work even on 2012R2. The results of running an ipconfig should return nothing that is IPv6 related and as such, pinging localhost should ping the v4 address. Jun 23, 2015 at 17:02
  • New finding shows that the correct value should be 0xFF instead of 0xFFFFFFF to avoid a 5-second boot delay. See the updated Microsoft KB929852 (This still does not disable the loopback though)
    – wandersick
    Aug 2, 2016 at 0:58
2

Have you tried removing the entry from the hosts file in %systemroot%\system32\drivers\etc? That should do it, if you just need "localhost" to always be IPv4. However, if it's based on the server name, this probably won't work.

2
  • 1
    The hosts file on windows is under %systemroot%\system32\drivers\etc and even if it doesn't contain an ipv6 reference for localhost pinging localhost will get a ::1 response.
    – Helvick
    Jan 4, 2011 at 22:00
  • You will get a 127.0.0.1 response, if you map localhost to that (and ONLY to that, not to IPv6)
    – Frank N
    Jan 28, 2013 at 16:41
0

You can also go into the properties of the NIC itself, and uncheck the IPv6 box, leaving IPv4 enabled. Should do the trick.

3
  • 3
    Doesn't work for loopback address...
    – Greg Bray
    Jan 6, 2011 at 23:27
  • awww! :( haha!!
    – JohnThePro
    Jan 7, 2011 at 16:56
  • This only disables the LAN interface. The tunnel and loopback are still connected here (verify via netsh interface ipv6 >show interface)
    – Chadddada
    Jul 14, 2011 at 14:53
-3

Try adding a line to your hosts file like:

::1 VPW-Web

This should enable the resolver to get VPW-Web as a name for IPv6 loopback.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .