Modify the hosts file to localize the domain name to the specified IP

  

How to modify the hosts file?

1) The location of the hosts file: C:\\windows\\system32\\drivers\\etc, find the Hosts file in the folder and open it with Notepad.

2) Add a separate line of records in the format of the ip address domain name. For example, 112.124.39.29 www.45it.com Note that there should be no spaces in front of the IP address, and there must be at least 1 space between the ip address and the domain name. After making changes, be sure to remember to save the file.

3) How do I know that the IP address of the domain name has taken effect? On your computer, please follow the steps below: Start-->Run-->Enter cmd-->ping Domain-->Enter to see the result Display results similar to Reply from 220.181.31.183: bytes=32 time =79ms TTL=53 The middle 220.181.31.183 is the IP address of the domain name

* Note: Some browsers will save the DNS cache, such as Chrome. Press F5 several times to refresh.

What is the role of modifying Hosts?

1) Speed ​​up domain name resolution

For websites that need to be visited frequently, we can configure the mapping between domain name and IP in Hosts, so that we can quickly resolve the domain name when we input the domain name computer. IP without requesting a DNS server on the network.


2) Convenient LAN users In many units of LAN, there are servers available to users. However, since the DNS server is rarely installed in the local area network, it is quite troublesome for many people to access these services by inputting a hard-to-remember IP address. Now you can give these servers a name that is easy to remember, and then create an IP mapping in Hosts so that we can enter the name of the server when we access it later.

3) Blocking Websites There are many websites that install a variety of plugins into your computer without the user's consent. Some may be Trojans or viruses. For these sites, we can use Hosts to map the domain name of the site to the wrong IP or the IP of the computer, so that there is no need to access it. For example, if you don't want to visit www.XXXX.com, then we write the following on Hosts: 127.0.0.1 www.XXXX.com #Shielded Website 0.0.0.0 www.XXXX.com #屏蔽的网站

Such a computer Parsing the domain name resolves to the local or the wrong IP, achieving the purpose of shielding.


4) Smooth connection system

For Lotus servers and some database servers, if you enter the IP address directly during access, you can't access it. You can only enter the server. Name can be accessed. Then we configure the Hosts file so that the server name can be successfully connected. Last but not least, the mapping of the Hosts file configuration is static. If the computer on the network changes, please update the IP address in time, otherwise it will not be accessible.

5) Forcibly specify a domain name corresponding to an IP address. The newly created website has been uploaded to the server and needs to be debugged but does not want to be accessed by outside, or you can modify the local hosts file when you don't want to be crawled by the spider. The computer can access the website through the domain name.

Copyright © Windows knowledge All Rights Reserved