Borrow the explanation of Baidu Encyclopedia
Hosts is a system file without extension, can be opened with Notepad and other tools, its role is to use some of the common URL domain name and its corresponding IP address to establish an association "database", when the user in the browser to enter a need to log in the URL, The system will automatically find the corresponding IP address from the Hosts file, once found, the system will immediately open the corresponding Web page, if not found, the system will submit the URL to the DNS domain name resolution server for IP address resolution.
More detailed Description: Http://baike.baidu.com/link?url=uwQLcpconowLlQZII12bLU58-5uT_4qX5UOCz_ Gr45aco6cyytcl4q-8vkzw4bxesjzavmbxyw6j8a2febwab_
File location
C:\Windows\System32\Drivers\etc\hosts
Content
# Copyright (c) 1993-2009 Microsoft corp.## This was a sample HOSTS file used by Microsoft TCP/IP for windows.## the This file Contains the mappings of IP addresses to host names. each# entry should is kept on a individual line. The IP address should# is placed in the first column followed by the corresponding host name.# the IP address and the host Name should is separated by at least one# space.## Additionally, comments (such as these) may is inserted on individual# Lines or following the machine name denoted by a ' # ' symbol.## for example:## 102.54.94.97 rhino.acme.com # so Urce server# 38.25.63.10 x.acme.com # x client host# localhost name resolution is handled within DNS itself. #1 27.0.0.1 localhost#::1 localhost
The file has been very clear, the main point, add IP with the domain name at least one space to separate.
For example, add a domain name, point to the machine, personal habits with tab-delimited.
127.0.0.1sn.cn
Test is active, open command line, ping
Problems
1, do not have permission to modify the Hosts file: http://jingyan.baidu.com/article/ab69b270d963542ca6189f75.html
2, after the amendment does not take effect, possible reasons
1). DNS Cache not refreshed
2). Dnsclient Service impact, reason to look at windows own instructions, shut down on the line, no longer disabled. Also does not affect other functions. Faster startup mode: Run Services.msc
3). 360 Security software to lock the Hosts file, the function of the 360 panel to find traffic firewall, repair it, the problem is very impressive, do not solve the previous operation is useless.
Windows hosts role and frequently asked questions resolved