0

When I ping localhost I can see that localhost name is resolved as :::1 instead of 127.0.0.1. Do you know how to solve this? I need a ipv4 resolution of localhost for Tomcat server.

I could quickly fix this with "127.0.0.1 localhost" to windows's hosts file, however I think can ben a better solution.

Tobia
  • 1,210
  • 8
  • 37
  • 73

4 Answers4

1

Frankly, use the host file. The reason it exists is to fix problems like the one you describe and so there is no reason not to use it.

Disabling IPv6 is unsupported and will break functionalities (although nothing critical). It is a far more disruptive change than touching the host file.

Stephane
  • 6,382
  • 3
  • 25
  • 47
0

You can disable IPv6 services if not use.

Enter the registry, find:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\Parameters

Add this:

  • Key: DisabledComponents
  • Type: DWORD
  • Value: 0xffffffff
cuonglm
  • 2,346
  • 2
  • 15
  • 20
  • 1
    Disabling IPv6 is not recommended on Windows Vista/2008 and up. It breaks functionality and MS is not testing for this scenario any more and so might not offer you support. ([ref](http://blogs.technet.com/b/jlosey/archive/2011/02/02/why-you-should-leave-ipv6-alone.aspx)) – Stephane May 06 '13 at 09:46
  • The topic is about Windows 7 and this method works good for me. MS also provide the update for this bug. – cuonglm May 06 '13 at 09:54
  • 2
    Please read my comment again and go to the reference I provided. You'll notice that this concerns Vista, 2008 **and up**. Disabling IPv6 is NOT a bug or a bug fix. – Stephane May 06 '13 at 12:16
  • This may solve, but It is a bit drastic.... I want to resolve in a different order the name "localhost" not to completely disabled the ipv6 for all names – Tobia May 06 '13 at 12:42
  • My method works for me. And I think if not use, disabled it. – cuonglm May 06 '13 at 15:09
0

I would suggest to make tomcat listen on the ipv6 stack too. Normally it should, which version do you use ?

André Schild
  • 258
  • 2
  • 9
0

you'd need to change the resolution order in the prefix policy table. I suspect however that this will not solve whatever problem you are having since 127.0.0.1 is ::1. Is tomcat is not getting a response back on the v4 stack (if its trying to connect to localhost on v4) there is some other problem going on. unless you have unbound v4 from the NIC you will always get v4 answers from the v4 stack and v6 answers from the v6 stack

To do so in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP6\Parameters

Add (If it does not exist) Key: DisabledComponents as a DWORD (32-bit) Value

Next

1.Find the current value data of DisabledComponents. 2.Change the data to binary data. It will be a 32-bit binary value. 3.Find the sixth bit of the data, and then set it to 0. Do not change any other bits. For example, if the current data is 11111111111111111111111111111111, the new data should be 11111111111111111111111111011111. 4.Change the data from binary to hexadecimal. 5.Set the hexadecimal value as the new value data for DisabledComponents.

Jim B
  • 23,938
  • 4
  • 35
  • 58