A very comprehensive explanation of the Hosts file

Source: Internet
Author: User

A very comprehensive explanation of the Hosts file
It is strange that many people do not know what Hosts is. Today, with the prevalence of Network viruses, it is actually very useful to know Hosts, because many web Trojans are eyeing this file, and in many cases, you only need to open the file and make a small modification to solve the problems you think are very difficult. 1. The Hosts file address is in the C: \ windows \ system32 \ drivers \ etc folder of Vista, Xp, 2000, and 2003. Windows 9x and Me systems: in the C: \ Windows folder. 2. Open method this file is actually a plain text file, which can be opened and edited using common text editing software such as Notepad and wordpad. Note that you must save the file after modification. 3. hosts file 3.1 accelerates domain name resolution for websites that require frequent access, we can configure the ing between the domain name and IP address in Hosts so that when we enter the domain name, the computer can quickly resolve the IP address without requesting the DNS server on the network. 3.2 It is convenient for LAN users to provide servers to users in LAN of many organizations. However, because DNS servers are rarely set up in Lan, it is quite troublesome for many people to access these services to enter hard-to-remember IP addresses. Now we can give these servers an easy-to-remember name, and then create an IP ing in Hosts. In this way, we can enter the name of this server for future access. 3.3 shielding websites many websites install various plug-ins on your computer without the user's consent. Some may be Trojans or viruses. For these websites, we can use Hosts to map the Domain Name of the website to the wrong IP address or the IP address of our computer, so that no access is required. For example, if you do not want to access www.xxxx.com, write the following content in Hosts: 127.0.0.1 www.baidu.com # blocked website-this is resolved to the local machine. when you open Baidu, an error will occur for the website 0.0.0.0 www.baidu.com # blocked-this is resolved to the wrong IP address, so that the computer will resolve the domain name to the local IP address or the wrong IP address, blocking is achieved. 3.4 smooth connection to the system for Lotus servers and some database servers, If you directly enter an IP address during access, it is not accessible, only the server name can be entered to access. Then we configure the Hosts file so that the server name can be successfully connected. Finally, it should be pointed out that the hosting configured in the Hosts file is static. If the computer on the network changes, update the IP address in time; otherwise, the IP address cannot be accessed. 3.5 forcibly specify the basic content and syntax of a domain name corresponding to an IP address 4. Hosts file use NotePad to open the hosts file, you can see Microsoft's description of this file. The Hosts file generally has the following basic content: 1 # Copyright (c) 1993-1999 Microsoft Corp. 2 #3 # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 4 #5 # This file contains the mappings of IP addresses to host names. each 6 # entry shoshould be kept on an individual line. the IP address shoshould 7 # be placed in the first column followed by the corresponding host name. 8 # The IP address and the host name shou Ld be separated by at least one 9 # space.10 #11 # Additionally, comments (such as these) may be inserted on individual12 # lines or following the machine name denoted by a' #'symbol.13 #14 # For example: 15 #16 #102.54.94.97 rhino.acme.com # source server17 #38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost #127.0.0.1 is a local ip address. This file works according to TCP/IP for Windows standards. It defines the ing between the IP address and the Host name. It is a ing between the IP address and the Host name. In this provision, each segment must contain only one ing relationship, that is, an IP address and a host name mapped to it. The IP address must be placed at the beginning of each segment, and the mapped Host name (Host name) must be placed behind the IP address, separated by spaces. For this section of ing description, use "#" to separate and then use text description. For example, 72.14.219.190 www.baidu.com resolves the domain name www.baidu.com to the IP address 72.14.219.190. Note: Do not have spaces before the IP address. There must be at least one space between the IP address and the domain name. 5. we know how the Hosts file works. to access a website on the network, you must first resolve the domain name (such as baidu.com) to the IP address of baidu.com through the DNS server, the computer can access this network domain name. For each domain name request, we have to wait for the Domain Name Server to resolve and return the IP address information. This will reduce the network access efficiency, because it takes time for DNS to resolve the domain name and return the IP address. To improve the resolution efficiency of frequently accessed network domain names, you can use the Hosts file to establish a ing between domain names and IP addresses. According to Windows System regulations, before a DNS request is made, Windows system will first check whether the network domain name ing relationship exists in your Hosts file. If yes, the IP address ing is called. If no, domain name resolution is submitted to the known DNS server. That is to say, the request level of Hosts is higher than that of DNS. This is why many web Trojans like this file. Here are some examples of using the Hosts file to shield some URLs. For more information about how to use the Hosts file, see. 6. Add the following content to the hosts file to shield the corresponding website defined in the file (the domain name is actually resolved to the local machine to prevent remote connection of the Trojan virus ). 1 127.0.0.1 localhost2 127.0.0.1 download.3721.com3 127.0.0.1 3721.com #3721 Network Real name 7. Do you know how to obtain the IP address corresponding to the domain name? Open "start-run", enter "cmd", enter "ping www.baidu.com" on the command line interface, and press Enter. The displayed result is similar to: Reply from 220.181.6.18: bytes = 32 time = 24 msTTL = 55. 220.181.6.18 is the IP address of the domain name (Baidu ).

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.