What is the meaning and function of the Host file

What is the meaning and function of the Host file

 

Friends who often come into contact with computers will see the ranking of Host from different places. So what is the file of Host? What does it do?
 

What is a HOST file:
Hosts is a system file without an extension. Its basic function is to establish an associated "database" between some commonly used URL domain names and their corresponding IP addresses.
When the user enters a URL in the browser that needs to be logged in , the
system will first automatically find the corresponding IP address from the Hosts file.
Once found, the system will immediately open the corresponding web page. If it is not found,
the system will submit the URL to the DNS domain name resolution server for IP address resolution.
If it is found to be blocked IP or domain name, it will be forbidden to open this page!
The location of the Host file: 
In XP and win7 systems, the HOST file
is located in the system disk C:\Windows\System32\drivers\etc.
If you don't see the Hos file in it, it is because some systems hide the Host file.
According to the above introduction, we can summarize the four main functions of the Host file:
1. Speed ​​up domain name resolution
For frequently visited websites, we can
improve the speed of domain name resolution by configuring the mapping relationship between domain names and IPs in Hosts. Due to the mapping relationship, when we enter the domain name, the computer can quickly resolve the IP
without requesting the DNS server on the network.
For example: Add an entry to the Host file: 222.73.44.198 blog.itful.com 
(there should be a space between the IP and the domain name, the IP address must be entered correctly, otherwise the website will not be accessible)
- you can run CMD and enter "ping website domain name” to get the IP address of the website!
In this way, the speed of visiting Xia Kedao will be slightly faster, because he does not need to go through the DNS domain name server for IP address resolution!
2. It is convenient for LAN users
. In the LAN of many units, there will be servers available for users to use.
However, since DNS servers are rarely set up in the local area network,
when accessing these servers, it is necessary to enter an IP address that is difficult to remember.
This is quite troublesome for many people.
Now you can give these servers an easy-to-remember name,
and then create an IP mapping in Hosts, so that you
only need to enter the name of the server when you access it later.
3. Block websites
There are many websites that install various plug-ins into your computer without the user's consent,
and many of them have virus Trojans.
For these websites, we can use Hosts to map the domain name of the website to a wrong IP or the IP of the local computer,
so that there is no need to visit.
In the Windows system,
127.0.0.1 is the IP address of the local computer, and 0.0.0.0 is the wrong IP address. 
For example, in Hosts, we enter the following content (an example)
127.0.0.1 www.sex.com # This website affects the healthy growth of my child, I want to block him
so, when the computer resolves the domain name www.sex.com, it resolves To the local IP or the wrong IP, the purpose of blocking unhealthy websites is achieved.
Now some viruses and malicious programs will modify our host file,
causing us to be unable to access some websites. When we find that some websites are inaccessible,
we can enter the Host file to observe.
If the website is inaccessible due to the Host file,
Delete the statement added by the virus, you can access the website normally

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325354454&siteId=291194637