Hosts file

I can not get in touch. What to do?

The hosts file associates IP addresses with host names (note that the file name does not have an extension). Without a unique IP address, which identifies computers on the TCP / IP network, you can not find the computer you need.

IP addresses are represented in the form of groups of digits - NNN.NNN.NNN.NNN, where NNN varies from 0 to 255 and in this form is difficult to remember and work. To facilitate memorization and access to IP addresses of computers, each IP address is assigned a domain name. The system converts the domain name by which a user accesses a particular computer to the appropriate IP address, and then uses it to establish a connection to the desired computer.

Initially, keeping 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. Having received from the user a domain name, the system searches the hosts file for the corresponding address. The system administrator is responsible for maintaining this list.

Due to the rapid growth of the Internet and the emergence of ever new and very large networks, the functions of converting domain names to IP addresses have been transferred to DNS servers (Domain Name Server). However, the hosts file is still used for storing domain names and the IP address of the host computers, the connections with which are most often established. This file is processed earlier than the query to DNS and therefore takes precedence which can be used not only to speed up access to the necessary sites, but also to prevent visiting unnecessary.

This is done simply by adding to the hosts file (open with Notepad) lines 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 just will not go to the DNS server. In this case, the browser instead of the coveted site will report that it can not open the page. Another curious application of this file is for redirecting requests of unwanted pages to some other site, for example, the MVD website :) But this, however, does not apply to our topic.

And what if the unwanted sites are not one and not ten, but hundreds / thousands? - you ask. How to cut them off? Do not write each address with your own hands ... Yes, indeed, you will be stupefied with such work. But part of it has already been done by the creators of the program for managing the hosts file. For example, there is a Hostess program , the author is Ray Marron, which represents the hosts file as a database file. And in this form, you can edit entries in it, add, search for duplicates, etc. Work will become much more convenient. Well, in order to work on something, you can download ready-to-use hosts files. For example, to lock adult sites, you can take a file from the Rubord forum , there are about 36,000 addresses in it. The file, although 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 take the finished file on the site winchanger , Mike Meyer or Excel .

Another application of this file is to create a quick access to a certain site.

For example, if you write the 209.85.229.147 g # google.com 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 google.com simply by typing one letter g into your browser's address bar. Note the entry # google.com, the # sign means that everything that goes after it to the end of the line is a comment and is ignored. Sometimes addressing one or two letters is more convenient than writing the most popular addresses in the favorites.

The hosts file, depending on the version of Windows, is 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 can be a virus or another parasite. For example, a virus like W32.Donk.Q writes to the hosts file entries preventing access to sites with updates from leading anti-virus vendors. In addition to it, there are a few more parasites that make entries in this file and disrupt the normal operation of security software. Remember that a clean hosts file contains a single working (uncommented) line in which it says: 127.0.0.1 localhost

Hence the conclusion: even if you do not intend to use the functions of this important file, you should take 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 its properties: you must include the Hidden, Read Only, and System attributes . Or download a couple of batch files (for XP / 2000 systems) - blocking lockhost.bat and unlocking unlockhost.bat ; For systems 98 / Me - LockHostsME.bat and UnlockHostME.bat and run the desired one.

In conclusion, it should be noted that sometimes incorrect entries in this file can interfere with the operation of the browser and you can get messages such as: Internet Explorer can not open the Internet site Web address. A connection with the server could not be established or Internet access the connection to the server was reset or even get to another page instead of the one requested.

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

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

In this case, we recommend that you disable the DNS Client service: at the command prompt, run the services.msc command, find the DNS Client service list, right-click Propecies, set Startup type to Manual, and reboot.

Yes! All manipulations with the hosts file on XP / 2000 systems must be performed 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 mappings of IP addresses to host names.  Each
	 # Entry should be kept on an individual line.  The IP address should
	 # Be placed in the first column.
	 # The IP address and the host name should be separated by 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