I'm running Windows 10 x64 and I have a legacy application that doens't work fine with localhost
being translated to ::1
, but instead it works for 127.0.0.1
.
How do I force Windows 10 to resolve localhost to 127.0.0.1
?
I've already edited the hosts file putting the following line, but it doesn't work (ping still show ::1
):
127.0.0.1 localhost
Remove IPv6, as your legacy application don't seem to support it.
Check the download there, it's a quick try easy to do:
How to disable IPv6 or its components in Windows
How to do it manually:
Manually disable or re-enable IPv6 or its components Disable IPv6 You can disable IPv6 on the host computer through the DisabledComponents registry value. The DisabledComponents registry value affects all network interfaces on the host.
Important Follow the steps in this section carefully. Serious problems might occur if you modify the registry incorrectly. Before you modify it, back up the registry for restoration in case problems occur.
To disable certain IPv6 components, follow these steps: 1. Click Start, type regedit in the Start Search box, and then click regedit.exe in the Programs list. 2. In the User Account Control dialog box, click Continue. 3. In Registry Editor, locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\
Note If the DisabledComponents entry is unavailable, you must create it. To do this, follow these steps: a. In the Edit menu, point to New, and then click DWORD (32-bit) Value. b. Type DisabledComponents, and then press Enter. c. Double-click DisabledComponents.
Use the DisabledComponents registry value to verify whether IPv6 is disabled. To do this, run the following command at a Windows command prompt: reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters /v DisabledComponents When you do this, you may receive the following error message:
ERROR: The system was unable to find the specified registry key or value. If you receive this error message, the DisabledComponents registry value is not set. If the DisabledComponents value is set, it overrides the settings in the connection properties.
Disable IPv6 on a specific network adapter You can do this by unbinding the adapter in the Local Area Connection Properties dialog box:1. Click Start, and then click Control Panel. 2. Click Network and Sharing Center. 3. In the View your active networks area, click Local Area Connection, and then click Properties. 4. On the Networking tab, clear the Internet Protocol Version 6 (TCP/IPv6) check box, and then click OK.
Note The Internet Protocol Version 6 (TCP/IPv6) check box affects only the specific network adapter and will unbind IPv6 from the selected network adapter. To disable IPv6 on the host, use the DisabledComponents registry value. The DisabledComponents registry value does not affect the state of the check box. Therefore, even if the DisabledComponents registry key is set to disable IPv6, the check box in the Networking tab for each interface can still be checked. This is expected behavior.
The only piece you should need to do is change the priority:
Open RegEdit, navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters Create DisabledComponents DWORD registry value, set its value to 20 (Hexadecimal). See Microsoft KB 929852 for more info about this registry key, especially if DisabledComponents already exists on your system. Reboot.