Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
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 '11 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 '11 at 0:22

6 Answers 6

Have you tried removing the entry from the hosts file in %systemroot%\system32\config\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.

share|improve this answer
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 '11 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) –  Fronker Jan 28 '13 at 16:41
up vote 7 down vote accepted

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
share|improve this answer
    
Did this remove the ipv6([::]) listening in netstat? –  Jared Burrows Mar 24 '13 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 '13 at 16:14
    
Thanks for confirming my problem! I was just making sure :) –  Jared Burrows Mar 26 '13 at 22:20

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.

share|improve this answer

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

share|improve this answer
2  
Doesn't work for loopback address... –  Greg Bray Jan 6 '11 at 23:27
    
awww! :( haha!! –  JohnThePro Jan 7 '11 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 '11 at 14:53

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.

share|improve this answer

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 0xffffffff. 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.

share|improve this answer
1  
According to your link (support.microsoft.com/kb/929852#letmefixit) this registry entry allows to disable IPv6 in many places EXCEPT loopback... –  Fronker Jan 28 '13 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. –  Ryan Bolger Jan 28 '13 at 19:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.