This topic covers the symptoms, causes, and resolution of website access failures on a Windows instance due to inconsistent DNS resolution.
Symptoms
You cannot access a website from a browser on your Windows instance, but you can access it from other devices. This issue can occur when DNS resolution for the domain on the instance is inconsistent with your local network.
-
You cannot access the website from the Windows instance, but you can access it from your local computer.
The browser displays an
ERR_CONNECTION_TIMED_OUTerror, indicating that the website took too long to respond. -
Log on to the Windows instance. In Command Prompt, run the
ping <website_domain>andnslookup <website_domain>commands. The output shows that the DNS resolution on the instance is inconsistent with your local network:Microsoft Windows [Version 10.0.17763.3770] (c) 2018 Microsoft Corporation. All rights reserved. C:\Users\Administrator>ping www.xxx.com Pinging www.xxx.com [192.xxx.22] with 32 bytes of data: Control-C ^C C:\Users\Administrator>nslookup www.xxx.com Server: UnKnown Address: 100.xxx.136 Non-authoritative answer: Name: www.xxx.com xxx Addresses: xxx::3f9 xxx::3fa xxx.244 xxx.243 Aliases: www.xxx.com C:\Users\Administrator>
Causes
Possible causes for the inconsistent DNS resolution between the Windows instance and your local network include:
-
The Windows operating system has a local DNS cache that may contain stale or incorrect records. To resolve this, see Flush the DNS cache.
-
The hosts file on the Windows operating system contains a static entry that maps the website's domain to a specific IP address. To resolve this, see Remove the conflicting entry from the hosts file.
-
For a Windows instance in a VPC, a PrivateZone record is configured for the domain. To resolve this, see Modify the PrivateZone record.
Resolution
The steps in this topic use an instance running Windows Server 2019 Datacenter as an example. The procedure may vary for other Windows versions.
Flush the DNS cache
-
Connect to the Windows instance.
For more information, see Connect to an ECS instance.
-
Flush the DNS cache on the Windows operating system.
-
In the search box, enter
cmd, and then click Command Prompt. -
In Command Prompt, run the
ipconfig /flushdnscommand to flush the DNS cache.C:\>ipconfig /flushdns Windows IP Configuration Successfully flushed the DNS Resolver Cache.
-
-
In Command Prompt, run the
ping <website_domain>command to verify that DNS resolution is working correctly.DNS resolution should now work correctly. The following example shows a successful response.
C:\>ping www.xxx.com Pinging www.xxx.com.xxx [115.xxx.xxx.253] with 32 bytes of data: Reply from 115.xxx.253: bytes=32 time=39ms TTL=101 Reply from 115.xxx.253: bytes=32 time=39ms TTL=101 Reply from 115.xxx.253: bytes=32 time=38ms TTL=101 Reply from 115.xxx.253: bytes=32 time=41ms TTL=101 Ping statistics for 115.xxx.253: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 38ms, Maximum = 41ms, Average = 39ms -
Try accessing the website again in your browser.
Remove the conflicting hosts entry
-
Connect to the Windows instance.
For more information, see Connect to an ECS instance.
-
Remove the conflicting mapping for the website from the hosts file.
Open the
C:\Windows\System32\drivers\etc\hostsfile. Check for an entry related to the website. If an entry such as192.xxx.xxx.22 www.xxx.comexists, delete the entire line and save the file. For example:# Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.xxx.xxx.xxx rhxxx.xxx com # source server # 38.xxx.xxx.xxx x.xxx com # x client host # localhost name resolution is handled within DNS itself. 127.0.0.1 localhost 192.xxx.xxx.22 www.xxx.com -
In Command Prompt, run the
ping <website_domain>command to verify that DNS resolution is working correctly. -
Try accessing the website again in your browser.
Modify the PrivateZone record
-
Perform the following checks:
-
Verify that the VPC of your Windows instance is included in the effective scope of the domain. If not, add the correct VPC in the Alibaba Cloud DNS console. For more information, see Set the effective scope for a domain.
-
Check if the configured DNS records are consistent with your business usage. If they are not, you need to modify the DNS records. For more information, see Modify DNS Records.
-
-
Try accessing the website again in your browser.
ImportantThe Windows instance automatically polls for and applies PrivateZone record updates every minute. No further action is required.