The ipv6 address in the hosts file cannot work

Jonathan Shi 0 Reputation points
2023-10-14T03:43:52.5033333+00:00

Under normal circumstances, the priority of the hosts file should be higher than the priority of using a DNS server, but if the hosts file uses ipv6 address, it will use the ipv4 address obtained by the DNS server

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wesley Li-MSFT 4,571 Reputation points Microsoft External Staff
    2023-11-16T07:26:01.6366667+00:00

    Hello

    The issue you’re experiencing might be due to the way your system is configured to resolve hostnames. By default, most systems will try to resolve hostnames to IPv4 addresses before trying IPv6.

    Here are a few things you could try:

    Check the Format of the IPv6 Address in the Hosts File: The IPv6 address should be written in the hosts file in the same format as an IPv4 address. For example: 2001:db8:1::1 example.com www.example.com.

    Specify the Zone ID: If you’re using a link-local address (starts with fe80), you need to specify the zone ID. For example: fe80::215:afff:fec6:ea64%11 realhost. You can find the zone ID using the command netsh interface ipv6 show addresses.

    Disable DNS over HTTPS (DoH) in Your Browser: If you’re using a browser like Firefox, it might be using DoH, which can bypass the hosts file. You can disable this option in the browser’s network settings.

    Change Network Settings: You could try changing the DNS server to localhost (127.0.0.1) in your network connection properties.

    Modify the /etc/netsvc.conf File: If you’re on a Unix-like system, you could try adding ‘hosts=local, local6, bind6’ to the /etc/netsvc.conf file. This entry causes the system to look at the host file’s IPv6 address for the hostname instead of the DNS server’s IPv4 addresses.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.