C:/Windows/system32/Drivers/etc/hosts what is the function ??

Source: Internet
Author: User
Tags domain name server

Parse the hosts file
Many users know that there is a hosts file in the window system (without a suffix). in Windows 98, this file is located in the Windows directory, and in Windows/XP, it is located in C: /winnt/system32/Drivers/etc directory. This file is actually a plain text file, which can be opened using common text editing software such as Notepad.

Open the hosts file in Notepad. First, you can see Microsoft's description of this file. This file works according to the TCP/ipforwindows standard. Its function is to include the ing between the IP address and the host name. It is a ing between the IP address and the host name) requires that each segment can only contain one ing relationship, the IP address should be placed at the beginning of each segment, and then enter the mapped Host Name (host name ). For this section of the ing description, use "#" to separate and then use text description.

Now let's take a look at how hosts works in windows.

We know that to access a website on the network, we must first resolve the network domain name (www.xxxx.com) to the IP address of 61. XXX through the DNS server, and then our computer can access the website. For each domain name request, we need to wait for the Domain Name Server to return IP information after resolution, so that the network access efficiency will be reduced, and the hosts file can improve the resolution efficiency. According to Windows System regulations, before a DNS request is made, Windows system will first check whether there is this address ing in its hosts file. If so, this IP address ing is called, if no domain name resolution is provided to a known DNS server. That is to say, the request level of hosts is higher than that of DNS.

What is the role of the hosts file in actual use?

1. Accelerate domain name resolution

For websites that require frequent access, we can configure the ing between the domain name and IP address in hosts, so that when we enter the domain name computer, we can quickly resolve the IP address, instead of requesting DNS servers on the network.

2. Facilitate LAN users

In the LAN of many organizations, servers are provided for users. However, because DNS servers are rarely set up in Lan, it is quite troublesome for many people to access these services to enter hard-to-remember IP addresses. Now we can give these servers an easy-to-remember name, and then create an IP ing in hosts. In this way, we can enter the name of this server for future access.

3. Website Blocking

Many websites install various plug-ins on your computer without your consent. Some may be Trojans or viruses. For these websites, we can use hosts to map the Domain Name of the website to the wrong IP address or the IP address of our computer, so that no access is required. We will write the following content in hosts:

127.0.0.1 # blocked website
0.0.0.0 # blocked website

In this way, the computer resolves the domain name to the local machine or the wrong IP address, to achieve the purpose of blocking.

4. Smooth system connection

For Lotus servers and some database servers, if you enter an IP address directly during access, it cannot be accessed. You can only enter the server name to access the server. Then we configure the hosts file so that the server name can be successfully connected.

Finally, it should be pointed out that the hosting configured in the hosts file is static. If the computer on the network changes, update the IP address in time; otherwise, the IP address cannot be accessed.
In addition, the pop-up advertisement webpage is not your machine's poisoning. You can use some software or browsers that shield the webpage from pop-up advertisements, such as aoyou,

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.