What is the purpose of the Windows system Hosts file

Source: Internet
Author: User

It is known that there is a Hosts file (no suffix) in the window System, which is located in the C:winntsystem32driversetc directory on the Windows system. The file is actually a plain text file that can be opened with ordinary text editing software such as Notepad. So what does he really do, the line for you to answer this question in detail, I hope you can help

Open the Hosts file with Notepad, first see Microsoft's description of this file. This file is based on the Tcp/ipforwindows standard, its role is to include the IP address and host name (hostname) mapping, is a mapping IP address and hostname (hostname) provisions, the requirements of each paragraph can only include a mapping relationship, The IP address should be placed at the front of each paragraph, and then the mapped host name (hostname) will be written on the space. For this section of the mapping instructions with "#" split after the text description.

Now let's look at how the hosts work in Windows.

We know that on the network to access the site, first through the DNS server to the network domain name (www.XXXX.com) to resolve to 61.xxx.xxx. After the IP address of xxx, our computer can access it. For each domain request we have to wait for the DNS server to return IP information, so that the efficiency of access to the network will be reduced, and the hosts file can improve the resolution efficiency. According to the Windows system, before a DNS request is made, the Windows system will first check if there is an address mapping relationship in its Hosts file, and if so, call this IP address mapping if no domain name resolution is presented to the known DNS server. This means that the hosts request level is higher than DNS.

Knowing how the Hosts file works, what does it do in specific use?

1, speed up the 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 (WWW.023DN.COM). 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. We wrote the following in the hosts:

127.0.0.1# Blocked Websites

0.0.0.0# Blocked Websites

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.

Related Article

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.