Modifying the Hosts file to locally resolve the domain name to the specified IP

Source: Internet
Author: User

How do I modify the Hosts file?

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

2) Add a separate row of records according to the format of the IP address domain name. For example
112.124.39.29 www.server110.com
Note that there is no space in front of the IP address, and there must be at least 1 spaces between the IP address and the domain name.
Make sure to remember to save the file after you modify it.

3) How do I know if the IP address of the domain is valid?
On your computer, follow these steps: Start-up, run-in, enter cmd-->ping domain name-and return to view results
Displaying results similar to Reply from 220.181.31.183:bytes=32 time=79ms ttl=53
The 220.181.31.183 in the middle 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 the hosts?

1) speed up domain name resolution

For sites that you want to visit frequently, we can configure the domain name and IP mappings in the hosts so that when we enter the domain name computer We can quickly resolve the IP without having to request a DNS server on the network.

2) convenient for local area network users
In many units of the local area network, there will be servers available to users. However, because the LAN generally rarely set up a DNS server, access to these services to enter the hard-to-remember IP address, for many people is quite troublesome. It is now possible to give these servers an easy-to-remember name, and then set up an IP map in the hosts so that we can enter the name of the server when we access it later.

3) Blocking Websites
Now there are many websites without user consent to install a variety of plug-ins to your computer, some may be Trojan or virus. For these sites we can use the hosts to map the site's domain name to the wrong IP or the IP of its own computer, so that it does not have access. For example, if you do not want to visit www.XXXX.com, we write the following in the hosts:
127.0.0.1 www.XXXX.com #屏蔽的网站
0.0.0.0 www.XXXX.com #屏蔽的网站

In this way, the computer resolves the domain name to native or wrong IP, and achieves the purpose of shielding.

4) Smooth Connection system

For Lotus servers and some database servers, if you enter the IP address directly when you access that is inaccessible, you can only enter the server name to access. Then we configure the hosts file so that the input server name can be successfully connected.
Finally, the mapping of the Hosts file configuration is static, and if the computer on the network changes, update the IP address in a timely manner, otherwise you will not be able to access it.

5) Mandatory to specify a domain name corresponding to an IP address
The new Web site has been uploaded to the server need to debug but do not want to be outside the cloth access, or do not want to be crawled by the spider, you can modify the local hosts file, so that only their own computer can access the site through the domain name.

Reprinted from Http://www.server110.com/operation/201308/16.html

Modifying the Hosts file to locally resolve the domain name to the specified IP

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.