What is the role of hosts?

Source: Internet
Author: User

The role of hosts is very large, to understand the role of hosts, first to know what is the hosts. Hosts file is a DNS resolution table for this machine, Hosts file is a Windows system in charge of IP address and domain name Fast resolution of the file, in ASCLL format to save. If you find that some sites are not open, you can first go to see if it is on this file is pointed to the IP127.0.0.1 of the machine. When the computer is typing the domain name, first will go to see the Hosts file summary has no regarding this domain name IP address record. If so, access the IP directly, if no more DNS servers are queried to request resolution of the IP address of the domain name. Many trojans and viruses use this file to block some anti-virus software upgrade sites, or some security sites to prevent users access to these security sites, as well as prevent users of anti-virus software upgrades. The Hosts file does not have a suffix name and can be opened using Notepad, but is not a txt text format. You need to be aware of when saving. Hosts in the Windows98 is Hosts.sam file, windows2000/xp, file name is hosts but no extension, you can use a text editor to open it. If you are unfamiliar with the hosts file, or if you are worried about editing errors, you can use the Hosts file editor.

Format of Hosts file

Once found, open it directly with Notepad, and "#" begins with an annotation statement that has no effect, only as a description.

The Hosts file is formatted as follows:

127.0.0.1 localhost

127.0.0.1

......

Similar to the format described above.

Location of Hosts file

Hosts table files are located in the system, different operating systems are different.

The Windows 9X system is stored in the C:windows directory,

Windows nt/2000 system, which is stored in the C:WINNTSYSTEM32DRIVERSETC directory,

Windows XP systems are saved in c:windowssystem32driversetc and can be searched through the system's search tools if they are not found.

The specific application of the hosts document

Hosts file as IP address and domain name Express resolution of the file, the main role is to facilitate the computer's IP and domain name between the conversion and resolution. Generally speaking, when a computer accesses a domain name, it first searches the hosts file and finds the corresponding parsing. such as: 127.0.0.1 on behalf of the corresponding IP address is: 127.0.0.1, then the computer will visit 127.0.0.1 this IP. To request a Web page. If no resolution is found in the Hosts file counterpart, the computer accesses the DNS server and requests the DNS server for resolution. The Hosts file corresponds to a local DNS parsing file table.

The magical uses of the Hosts file

The Hosts file has the highest priority as a local DNS resolution file. We can use him for some special applications.

First: Visit the website to accelerate

We generally enter a Web site request access, the computer will request a DNS server to determine the corresponding IP address, and then access the corresponding IP, and we can also be some commonly used sites and IP corresponding list to fill in. Accelerates DNS resolution. Thus speeding up access to the site.

For example, enter the following in the Hosts file:

61.145.121.108 www.58116.cn

After saving, reopen the browser.

When you visit the website again, you will find that the speed has changed. Of course, the actual use of these large sites have a stable DNS server, the speed may not be obvious, if it is some small sites, such as some small sites, and its own DNS server. The speed of access may be significantly increased.

Second

Use Hosts file to screen ads or bad websites

Go from computer to master network

Locate the Hosts file, right-click on the way, and choose to open with Notepad. Edit the Hosts file.

Add the following:

127.0.0.1

Save the list. Then reopen IE browser (or other browser), access to the above URL, is not found to open?

The purpose of this list is to tell the computer that the corresponding IP of these sites is 127.0.0.1, and 127.0.0.1 is the IP address of this machine. Naturally impossible to access. So these sites can not be opened. You can take some websites that do not want to let the child visit according to the above format, fill in the Hosts file, you can block the visit of these sites. It's OK to block out some annoying ads.

In fact, there are many advertising removal software can achieve the function of removing advertising. But the software can only be designed to screen the site, and the use of a lot of inconvenience. Some sites, such as the university's website, pop-up window is not advertising, but notifications and other information, but the ad removal software will be blocked. and using the above method, you can be flexible to the needs of their own shielding.

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.