Wen/Geven
Initially thought of using the Hosts file is based on the school across the network access to the Web page with the inconvenience of IP address access: The school teaching network system is divided into four network segments, including three students computer room network segment and an Office teacher network segment, the server does not use DNS. Some Office teachers have opened PWS (Personal Web server), the teacher in the same network segment input host name (host name) to access the Web page smoothly, but in the student room to access the teacher Web page, you must use the IP address.
Hosts are files that were used by Windows to establish IP addresses and host name (hostname) mapping relationships earlier. This way, when you access the host on the client computer, just enter the host name. With the introduction of the concept of DNS later, the establishment of Internet DNS server, this document has been gradually forgotten by people. Because the Hosts file's execution priority is higher than DNS domain name resolution, in order to prevent hosts and DNS domain name access confusion, in Windows 98 to the hosts to Hosts.sam, is to cancel the file's domain name resolution function. This article is precisely the use of the Hosts file this function.
Hosts.sam file is located in the C:\Windows folder, to use its function, first change to the Hosts file, that is, to remove the extension. With Notepad to open the Hosts file, the first thing to see is Microsoft's description of this document. This file works according to the TCP/IP for Windows standard, requiring that each segment include only one mapping relationship, the IP address to be placed at the top of each paragraph, and then the mapped host name (host name) after the space, such as:
127.0.0.1 www.sina.com.cn
#屏蔽新浪网站
192.168.0.250 www.stw.net
#学校内部Web服务器主机名映射
In accordance with the above method input, open the browser to enter the two domain name, but there is a problem: Sina can still be normal access, but the speed of the page opened slowly (not blocked), and the school's internal Web site is still not properly accessible. Occasionally in MS-dos Ping the two domain names, but found that the mapping has been set up. Why is it that you can ping the DOS command line and not map it correctly in the browser?
Explain only one: is the hosts set is valid, IE browser let hosts set invalid.
Open the browser, the author of IE's "Internet Options" settings are studied, and finally found the crux of the problem, and found a solution.
My school client is surfing the Internet through an HTTP proxy, so the settings shown in Figure 1 are in the browser. Remove "For LAN use proxy server" before "√", the above mapping in IE all effective, and the campus network across the network segment of the Web page can be through http:// Www.stw.net visited, but new problems came up, and when you visited other Internet pages in your browser, you were unable to connect, that is, you can access the intranet at this time, and you cannot access the extranet. It seems that this method is still not workable. So can not switch off the proxy server, but also to use the above mapping relationship? With this problem, I have opened the advanced options for local area network (LAN) settings, open the Proxy Server Settings dialog box (Figure 2), add the URL to be screened in the hosts file to the "Exception" text box, [OK] and then exit, when the extranet can be accessed, shielding also has a role.
The above problems for the user through a single link into the public network is not to be met, because it does not need to set proxy server, for the requirements of the public network with the agent and want to block the unhealthy Web page users, it is necessary to do so.