0

This question already has an answer here:

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.

marked as duplicate by Michael Hampton, Ward, Jenny D, Andrew, TheCleaner May 7 '13 at 13:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.

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
  • 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) – Stephane May 6 '13 at 9:46
  • The topic is about Windows 7 and this method works good for me. MS also provide the update for this bug. – cuonglm May 6 '13 at 9: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 6 '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 6 '13 at 12:42
  • My method works for me. And I think if not use, disabled it. – cuonglm May 6 '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 ?

  • Tomcat version 7 – Tobia May 6 '13 at 12:35
  • However I would like to understand how windows 7 choose ip version... – Tobia May 6 '13 at 12:40
  • Windows 7 (and Vista, and W2K8, and W2K8R2 and W2K12) default to IPv6. – joeqwerty May 6 '13 at 14:11
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.

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