I initially thought that the use of the HOSTS file was inconvenient to use IP address access when the school across network segment was accessing the webpage: the school teaching network system divided into four network segments, including three student machine network segments and an office teacher network segment, servers No DNS is used. The office teacher has a PWS (personal web server), and the teacher enters the Host Name in the same network segment to access the web page, but in the Student Room to access the teacher's web page, you must use the IP address.
Hosts is a file that Windows used to establish an IP address and Host Name (hostname) mapping relationship. This allows you to enter the host on the client. With the introduction of the DNS concept, the establishment of the DNS server on the Internet, this document has been gradually talked. Since the execution priority of the HOSTS file is higher than the DNS domain name resolution, in order to prevent the chaos of the HOSTS and DNS domain access, HOSTS is changed to hosts.sam, which is to cancel the domain name resolution of the file. This article is precisely this function of the HOSTS file.
Hosts.sam files are located in the C: / Windows folder, to use its feature, first change to the HOSTS file, which removes the extension. Use Notepad to open the hosts file, first seeing Microsoft's instructions for this file. This file is based on the standard of TCP / IP for Windows. The specification requires that each paragraph can only include a mapping relationship. The IP address is placed in the forefront of each paragraph, and the Host Name mapping it is written after the space. ,Such as:
127.0.0.1 www.sina.com.cn
# 屏 新浪 网 网站
192.168.0.250 www.stw.net
# School Interior Web Server Host Name Mappings
After entering the browser, open the browser to enter the above two domain names, there is a problem: Sina is still accessing, but the speed of the web page is slow (not blocked), but the internal website is still not correct. . Casually in MS-DOS ping, the two domain names are found, but the mapping has been established. Strange, why can I ping in the DOS command line, but can't map correctly in the browser?
Explanation only one: The Hosts setting is valid, and it is the IE browser to make Hosts settings invalid.
After opening the browser, the author has studied the IE "Internet Options" setting, and finally discovered the problem of the problem and found a solution.
Our clients are internet access via HTTP proxy, so the settings shown in Figure 1 in the browser. After removing "√" as "√" for the LAN Using Proxy Server ", the above mapping has taken effect in IE, and the web page of the campus network can be accessed by http://www.stw.net; but new The problem occurs again. When accessing other Internet pages in the browser, it is displayed that cannot be turned on, that is, the intranet can be accessed, and the external network cannot be accessed. It seems that this method is still not working. So can you not turn off the proxy server, can you use the above mapping relationship? With this issue, I opened the "LAN) Settings" [Advanced] option to open the Proxy Server Settings dialog (Figure 2), add the URL to which you want to shield in the HOSTS file to "exception" In the text box, the [OK] is exited, and the external network can be accessed, and the mask also has a function.
The above problem is not impossible for users who are sub-bus into the public network because it does not need to set a proxy server; for the required proxy connection public network, I want to shield unhealthy webpage, I need this to do this. .