1. What is a hosts file?
The hosts file is stored in system32 \ drivers \ etc in the Windows directory. This file does not have an extension, but we can use NotePad to open and edit it. Open the file and you can see that there are many English interpretations. At the end of the file, there is a line of 127.0.0.1localhost. This file includes the IP address and image name of the host. Each address entered should be placed in a separate column. The IP address should be placed in the first column of the corresponding host name. There should be at least one space between the IP address and the host name.
When we access a website, the request level of the hosts file is higher than that of the DNS server. Therefore, modifying the hosts file can process the specified URL to prevent users from accessing a specific website.
The hosts file also speeds up Website access. When we access the network, our computer sends a network domain name to the DNS server, and the DNS server resolves the domain name into an IP address and returns it to the computer. This process slows down Website access. Correct editing of the hosts file can speed up Website access. For example, add a specified IP address to the hosts file so that the DNS server does not need to parse the webpage address. For details about how to directly access the specified website, see the following.
In fact, the hosts file also has other special advanced functions, such as facilitating LAN users to smoothly connect to the system. These functions can greatly reduce the access time to the network, making access to the network faster and more convenient.
2. Shielding specific websites
To shield a specific website, we can do the following.
1. In C: \ windows \ system32 \ drivers \ etc, find the hosts file and open it in notepad.
2. Enter the addresses of the websites you want to shield at the bottom of the file. The format is as follows:
127.0.0.1 www.my123.com
127.0.0.1 my123.com
3. Save the hosts file.
4. Change the hosts file attribute to read-only to prevent virus tampering.
3. Accelerated Website access
To speed up website resolution and speed up Website access, you must first find the IP address of the website you want to access. You can use the ping command. Open the hosts file and add "ip address domain name" at the end of the file ".
Finally, save the hosts file and change it to the read-only attribute. When you browse the website again, the resolution of the domain name-IP address will be completed by your local machine. You do not need to access the DNS server, which speeds up Website access.