This page has been robot translated, sorry for typos if any. Original content here.

Hosts file

I can not get in touch. What to do?

The hosts file associates IP addresses with host names (note! The name of this file does not have an extension). Without a unique IP address that computers are identified on a TCP / IP network, the desired computer cannot be found.

IP addresses are represented as groups of numbers - NNN.NNN.NNN.NNN, where NNN varies from 0 to 255 and as such is difficult to remember and work. To facilitate memorization and access to the IP addresses of computers, each IP address is assigned a domain name. The system converts the domain name through which the user accesses a specific computer into the corresponding IP address, and then it is used to establish a connection with the desired computer.

Initially, maintaining a list of host names with their IP addresses was the responsibility of all computers on the network. This list is still stored in the hosts file. After receiving a domain name from the user, the system looks for a corresponding address in the hosts file. The system administrator is responsible for maintaining this list.

Due to the rapid growth of the Internet and the emergence of new and new very large networks, domain name conversion functions have been transferred to Domain Name Server (DNS) servers. However, the hosts file continues to be used to store the domain names and the IP address of the host computers with which connections are established most frequently. This file is processed before the request to the DNS and therefore has the priority that you can use not only to speed up access to the necessary sites, but also to prevent visits to unnecessary ones.

This is done simply by adding the line 127.0.0.1 www.site.com hosts (opening notepad) 127.0.0.1 www.site.com where 127.0.0.1 is the internal address of your computer (localhost). Thus, the request to the site www.site.com will be wrapped in a loop inside the computer and simply will not go to the DNS server. In this case, the browser instead of the desired site will report that it can not open the page. Another interesting application of this file is to redirect requests for unwanted pages to some other site, for example, the MIA site. :) But this, however, does not apply to our topic.

And what to do if unwanted sites are not one and not ten, but hundreds / thousands? - you ask. How to cut them off? Do not prescribe the same address with your hands ... Yes, and really stupid from such work. But part of it has already been done by the creators of the programs to manage the hosts file. For example, there is a program Hostess , the author is Ray Marron, which presents the hosts file as a database file. And in this form, you can edit, add, search for duplicates in it, etc. Work will become much more convenient. Well, so that there was something to work on, you can download ready-to-use hosts files. For example, for locking adult sites you can take a file from the forum Rubord , it has about 36,000 addresses. The file, though not the first freshness, but the most popular sites will be cut off reliably. To cut off all kinds of advertising and banner sites, you can get the finished file on the site winchanger , Mike Meyer-a or Exler .

Another use of this file is to create quick access to a specific site.

For example, if you write the following line in hosts: 209.85.229.147 g # google.com then assign the name g to 209.85.229.147 and you can go to the website of the search engine google.com simply after entering one letter g into the address bar of the browser. Notice the # google.com post, the # sign means that everything that comes after it to the end of the line is a comment and is ignored. Sometimes addressing one or a couple of letters is more convenient than writing the most popular addresses in favorites.

The hosts file, depending on the version of Windows, is located in different folders: Windows XP -> C:\WINDOWS\SYSTEM32\DRIVERS\ETC Windows 2K -> C:\WINNT\SYSTEM32\DRIVERS\ETC Win 98 \ ME -> C:\WINDOWS

As you can see, in Windows XP and 2000, the file is hidden from prying eyes in the depths of the system folders, which in general shows its importance. However, this is not at all an obstacle for intruders and viruses.

It is clear that not only you can make changes to this file, but also someone else. Including it may be a virus or another parasite. For example, a virus such as W32.Donk.Q writes entries in the hosts file that prevent users from connecting to sites with updates from leading antivirus vendors. In addition to it, there are a few more parasites that make entries in this file and disrupt the normal operation of protective programs. Remember that a clean hosts file contains the only working (uncommented) line that says: 127.0.0.1 localhost

Hence the conclusion: even if you do not intend to use the functions of this important file, it is worth taking care of its safety. The easiest way to change the attributes of a file is to find it by the path specified for your system and right-click to see its properties: you must enable the Hidden, Read Only, and System attributes. Or download a couple of batch files (for XP / 2000 systems) - locking lockhost.bat and unlocking unlockhost.bat ; for systems 98 / Me - LockHostsME.bat and UnlockHostME.bat and launch the desired one.

In conclusion, it should be noted that sometimes incorrect entries in this file can interfere with the browser and you can receive messages like: Internet Explorer cannot open the Internet site Web address. It couldn’t be established or Internet Explorer couldn’t be able to go to another page instead of the requested one.

Such problems are described on the Microsoft website . In this case, try changing the name of the hosts file to any other (for example, hosts.txt) and after reloading, try again on the same site. Or, if you know exactly where the error is, comment out this erroneous line by putting a # sign at the beginning of the line.

Another problem may arise when using a very large hosts file on XP / 2000 systems - brakes when the browser is running.

In this case, it is recommended to disable the DNS Client service: run the services.msc command in the command line, find the Client in the list of services, right-click in the properties (Propeties), set the Startup type to Manual and reboot.

Yes! All manipulations with the hosts file on XP / 2000 systems must be done under the administrator's login.

Contents of the original clean hosts file

	 # Copyright (c) 1993-1999 Microsoft Corp.
	 #
	 # This is a sample HOSTS file used by Microsoft TCP / IP for Windows.
	 #
	 # This file contains the IP addresses to host names.  Each
	 # entry line  The IP address should
	 # be placed in the first column followed by the corresponding host name.
	 # The IP address should be at least one
	 # space.
	 #
	 # Additionally, comments (such as these) may be inserted on individual
	 # lines or following the machine name denoted by a '#' symbol.
	 #
	 # For example:
	 #
	 # 102.54.94.97 rhino.acme.com # source server
	 # 38.25.63.10 x.acme.com # x client host

	 127.0.0.1 localhost