win10 localhost resolves to ipv6 address:: 1 Solution

Source: Internet
Author: User

Today, a strange problem has occurred, the localhost access is not found 404, but there are 127.0.0.1 to access. The reason was finally found because Windows resolved localhost to IPv6 address: 1 instead of 127.0.0.1. Check the hosts to IPv6 has been blocked, 127.0.0.1 localhost also has, is not normal parsing. Baidu search for a half-day without fruit, and finally use scientific Internet method in Google to find a solution to prevent the original paste is lost, posted here (original address: http://superuser.com/questions/436574/ ipv4-vs-ipv6-priority-in-windows-7/436944#436944).

Article content:

Solution #1: Add A prefix policy to prefer IPV4 addresses over IPv6

Prefix Policy table is similar a routing table, it determines which IP addresses was preferred when making a connection. Note that higher precedence in prefix policies are represented by a lager ' precedence ' value, exactly opposite to routing T Able "cost" value.

Default Windows prefix policy table:

C:\>netsh interface ipv6 show prefixpoliciesQuerying active state...Precedence  Label  Prefix----------  -----  --------------------------------        50      0  ::1/128        40      1  ::/0        30      2  2002::/16        20      3  ::/96        10      4  ::ffff:0:0/96         5      5  2001::/32

Note that IPV6 addresses (::/0) is preferred over IPv4 addresses (::/96,:: ffff:0:0/96).

We can create a policy that would make Hurricane Electric IPv6 Tunnel less favourable than any IPV4 address:

netsh interface ipv6 add prefixpolicy 2001:470::/32 3 6

2001:470::/32 is Hurricane Electric ' s prefix, 3 are a precedence (very low) and 6 are a Label.

I could has used a more generic prefix, but I wanted-make sure than if and when I get a direct IPV6 connectivity from An ISP, it'll take the precedence over IPv4.

If you adapt the solution, you need to substitute an appropriate IPV6 prefix instead of my Hurricane Electric one.

Solution #2: Tweak registry to make Windows always prefer IPv4 over IPv6

This solution was more generic, but more invasive and less standards-compliant. In the end, Windows would still modify the prefix policy table for you.

    • Open RegEdit, navigate toHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\tcpip6\Parameters
    • Create DisabledComponents DWORD registry value, set its value to (hexadecimal). Seemicrosoft KB 929852 For more info about this registry key, especially if DisabledComponents already exists on your system.
    • Reboot.

English is not very good, at last, according to the translation software probably understand point. Is that Windows has a prioritized parsing list, and when IPv6 has a higher priority than IPv4, the situation I encountered today (though this is still not found). The first way is to add a priority IPv4 precedence higher than IPv6 records to the priority resolution table, because many words are not understand, afraid of the wrong parameters, not dare to use. I use the second solution, is to modify the registry, the method is as follows (do not know English friends do not have to check):

Open the registry, locate the key Hkey_local_machine\system\currentcontrolset\services\tcpip6\parameters , and add the type DWORD The item with the name disabledcomponents (without adding a direct change value). Then change the value to 16 and the value type to binary . This will be done, then save the registry and restart your computer. Try pinging the localhost again.

win10 localhost resolves to ipv6 address:: 1 Solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.