The method of repairing Hosts file in Win8.1 system

Source: Internet
Author: User

I do not know if you have encountered the issue of the failure of the hosts file. The Hosts file for my Windows 8.1 system was originally available, but it has somehow suddenly failed recently. Hosts file failure to my work brings a lot of trouble, in order to analyze the specific reasons, I give you a demo test.

Visible Hosts file paths are right, and only one line of mappings ensures that there are no other distractions.

Use Ipconfig/flushdns to clean up the DNS cache, and I actually stopped the DNS Client service. Then continue the ping and still return the address of the real DNS resolution.

Visible the system's permissions are also assigned. The following is my own account and the Admin group's account permissions are fully controlled.

This is the case, and somehow the recent failure has occurred. Did I have a hostage?

Analytical Processing

Based on my conjecture in the quote, I used the message logger to track system messages related to the Hosts file. For comparison, I also operate under Windows XP, which runs in Windows 8.1 and virtual machines, for comparison purposes.

First of all, I found that all the programs that have network communication function will go to detect Hkey_local_ Machinesystemcurrentcontrolsetservicesdnscacheparameters whether there is a Usehostsfile value under this key, and how much data is available. But I found that no matter XP or 8.1 does not have this value, but according to the previous experiment that XP can read the Hosts file, so you can conclude that this is irrelevant. (However, according to this judgement, the original DnsCache service (that is, in the service to display the name of DNS client services, to cache the results of DNS resolution) can be manually forced not to read the Hosts file, modify this key value can be

Then I found a strange phenomenon, every time I manually modify the Hosts file, in 8.1 will show a process named Svchost.exe attempt to access the hosts file but the result is acces Denied. Under XP, a process with the same name tried to access the hosts file but the result was success.

Depending on the PID of the process provided by the message logger, a common service in the service being traced to it is the DNS Client. It can be concluded that the DNS Client service mentioned above is certainly problematic. Because the access file is denied, it must be an account problem, so I habitually open the DNS Client property page and go to the Login tab and find that the account it uses is not the default Local system account, but a built-in security principal named "Network Service."

All of this is clear, in the final analysis is a matter of competence. The DNS Client service uses an account that is not system, but network service. Although I give the System account full access control, I can see from my opening screenshot that I am missing the security principal of the Network service. Now we can conclude that the system account is not associated with the Network Service security principal, which is why the hosts file cannot be read properly after the DNS Client service has been started, which results in the host files being invalidated.

The solution is to edit the access rights of the ETC folder, add the Network Service security principals, and give at least Read permission, and then restart the DNS Client service. At present, my hosts have been all normal.

Through the above analysis, I believe you can more clearly understand the Windows 8.1 system Hosts file invalidation reasons, but also can grasp the solution to its countermeasures. In the end, our Hosts file can be restored to normal.

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.