In the actual application process, we may encounter the problem of DNS resolution errors, which means that when we access a domain name, we cannot complete the work of parsing it into an IP address, but directly enter the website IP, we can access it normally. This is because DNS resolution occurs. caused by malfunction. The probability of this phenomenon happening is relatively high, so this article will teach readers some basic methods to troubleshoot DNS resolution failures from scratch.
1. What is DNS resolution failure?
Generally speaking, addresses like www.sina.com and www.it168.com we visit are called domain names. As we all know, any host on the network is identified by an IP address. That is to say, only if you know the IP of this site The address can successfully implement the access operation.
However, because IP address information is not easy to remember, the name domain name appears in the network. When accessing, we need to enter this easy-to-remember domain name. There will be a server in the network that automatically resolves the corresponding domain name into an IP address. , this is the Dns server. The machine that can realize the DNS resolution function can be your own computer or a computer in the network. However, when an error occurs in DNS resolution, for example, a domain name is resolved into a wrong IP address, or the corresponding IP address of a domain name is not known at all. When the IP address is, we cannot access the corresponding site through the domain name. This is a DNS resolution failure.
The biggest symptom of a DNS resolution failure is that there is no problem accessing the IP address corresponding to the site, but an error occurs when accessing its domain name.
2. How to solve DNS resolution failure:
Don't worry when our computer has a DNS resolution failure, the solution is also very simple.
(1) Use nslookup to determine whether it is really a DNS resolution failure:
If you want to 100% determine whether it is a DNS resolution failure, you need to use the system's own NSLOOKUP to solve it.
Step 1: Confirm that your system is Windows 2000 and Windows XP or above, then enter the command line mode through "Start->Run->Enter CMD" and press Enter.
Step 2: Enter the nslookup command and press Enter to enter the DNS resolution query interface.
Step 3: The command line window will display the DNS server address used by the current system. For example, the author’s Dns server IP is 202.106.0.20.
Step 4: Next enter the domain name corresponding to the site you cannot access. For example, the author enters www.softer.com. If it cannot be accessed, then DNS resolution should not be able to proceed normally. We will receive a prompt message that DNS request timed out, timeout was 2 seconds. This shows that our computer indeed has a DNS resolution failure.
Tip: If the DNS parsing is normal, the correct IP address will be fed back. For example, if I use the address www.sohu.com for query and parsing, I will get the information name:sohu.com, addresses: 61.135.133.103, 61.135.133.104 .
(2) Check whether the Dns server is working properly:
At this time, we need to check the DNS address used by our computer and query its operation status.
Step 1: Confirm that your system is Windows 2000 and Windows XP or above, then enter the command line mode through "Start->Run->Enter CMD" and press Enter.
Step 2: Enter the ipconfig /all command to query network parameters.
Step 3: In the ipconfig /all display information, we can see a place that says DNS SERVERS. This is our DNS server address. For example, the author's are 202.106.0.20 and 202.106.46.151. It can be seen from this address that it is an external network address. If a resolution error occurs when using external network DNS, we can change the address of another Dns server to solve the problem.
Step 4: If the DNS server displays your company’s internal network address, it means that your company’s DNS resolution work is completed by the company’s internal DNS server. At this time, we need to check this DNS server. In DNS Perform an nslookup operation on the server to see if it can be parsed normally. Solving the DNS service failure on the Dns server can generally solve the problem.
(3) Clear DNS cache information method:
When a computer accesses a domain name, it does not need to seek help from the DNS server every time it accesses it. Generally speaking, after the resolution work is completed once, the resolution entry will be saved in the computer's DNS cache list. If the DNS resolution changes at this time, If there is a change, since the DNS cache list information has not changed, when the computer accesses the domain name, it will still not connect to the Dns server to obtain the latest resolution information, but will resolve it based on the cache correspondence saved on the computer. This will cause a DNS resolution failure. At this time we should solve the fault by clearing the DNS cache command.
Step 1: Enter the command line mode through "Start->Run->Enter CMD".
Step 2: In the command line mode, we can see that there is a parameter named /flushdns in ipconfig /?. This is the command to clear DNS cache information.
Step 3: Execute the ipconfig /flushdns command. When the prompt "successfully flushed the dns resolver cache" appears, it means that the cache information of the current computer has been successfully cleared.
Step 4: When we access the domain name again, we will go to the Dns server to obtain the latest resolution address. There will no longer be resolution errors caused by previous caches.
(4) Modify the HOSTS file method:
Modifying the HOSTS method is to modify the DNS resolution correspondence in the HOSTS file to achieve the purpose of correct resolution. Because when the local computer accesses a domain name, it will first check the HOSTS file in the local system. The priority of the resolution relationship in the HOSTS file is greater than the resolution relationship on the Dns server.
In this way, if we want to bind a domain name to an IP address, we can do so by adding a resolution entry in the HOSTS file.
Step 1: Go to "Start->Search" and then look for the file named hosts.
Step 2: Of course, readers who already know its path can directly enter the c:windowssystem32driversetc directory to find the HOSTS file. If your system is Windows 2000, you should search in the c:winntsystem32driversetc directory.
Step 3: Double-click the HOSTS file and choose to open it with the "Notepad" program.
Step 4: Then we will see all the contents of the HOSTS file. By default, there is only one line of content "127.0.0.1 localhost". (Other lines preceded by # are not real content, just help information)
Step 5: Add the entries you want to perform DNS resolution to the HOSTS file. The specific format is to first write the IP address corresponding to the domain name, and then follow the domain name information with spaces. For example, the author added two entries: "211.153.80.1 www.ftedu.gov.cn" and "10.82.0.1 www.ftedu.gov.cn".
Step 6: After the settings are completed, when we visit www.ftedu.gov.cn, it will be automatically parsed according to whether it is on the internal network or the external network.
3. Summary:
Through the four steps introduced above, we can solve most DNS resolution problems. The first three of these methods are to solve DNS resolution failures step by step, while the last one is to modify the HOSTS file when there is really no other way. time, a stopgap measure. Of course, no matter which method we use, we can solve network failures caused by DNS resolution errors. I believe these methods can help IT168 readers solve more practical problems.