First, the fault description
1, for everyone to do a demo test, please look at the following figure:
2, the visible Hosts file path is right, and only one line mapping to ensure that there are no other interference items.
3, using Ipconfig/flushdns to clean up the DNS cache, and in fact, I also stopped the DNS Client service. Then continue the ping and still return the address of the real DNS resolution.
Second, the cause of the failure
Visible the system's permissions are also assigned. The following is my own account and the Admin group's account permissions are fully controlled.
Third, the solution
1, edit etc folder access rights, add Network Service security principals and give permission to read at least, and then restart the DNS Client service. At present, my hosts have been all normal.
2, press win+ x key, click "Command Prompt (Admin)", and then enter the following command to press ENTER (enter) to execute:
SC Stop DnsCache
SC config dnscache obj= "NT authoritynetworkservice"
Icacls "%windir%system32driversetc"/grant "NT authoritynetworkservice": RX
SC start DnsCache
Stop DnsCache (DNS Client) service
Configure the security principals running the DnsCache service as network services
Give the ETC folder ownership to the Administrators group
Add read and execute access to the ETC folder for the Network service
Start the DnsCache service