Hosts - what should it be? Hosts file

Windows operating system (OS) (like other OSs) has the ability to accelerate the transition to the IP address of the site you typed in the address bar without accessing the DNS domain name system - DomainNameSystem. For this, a special operating system file called hosts is used (used without any extension). The question arises: "The hosts file - what should it be?"

hosts what should be there
hosts what should be there

What is needed for and what does the hosts file contain

If the file’s name matches the site’s name with its actual IP address, then redirection occurs without contacting your ISP’s DNS service. Hosts file is a plain text file that can be opened with any text editor, for example Notepad (but it requires administrator rights). By default, the file contains several lines of explanations (comments) in English or Russian and a single executable line that provides redirection to the IP address of the computer of calls to the localhost name.

Where is the hosts file located

Typically, the hosts file can be found:

  • on Windows OS versions 95/98 / ME, in the WINDOWS directory;
  • on Windows NT / 2000, at WINNT \ system32 \ drivers \ etc;
  • The Windows 7 hosts file (and versions of Windows XP / 2003 / Vista / 8) is in the WINDOWS \ system32 \ drivers \ etc directory.

Other operating systems also have a hosts file with similar features. Where the hosts file is located in these operating systems should be considered separately.

Why is a virus protection file important?

The importance of resolving the issue of hosts, what should be there, is that some malicious programs use the special properties of this file to protect against anti-virus programs and to block the call of some files. Indeed, if the redirection of anti-virus programs to a false IP address is written in the hosts file, then the computer will not be able to run these programs, and, for example, the anti-virus databases will simply not be updated.

Therefore, if your computer has problems with the operation of antivirus programs, one of the reasons could be an unauthorized modification of the hosts file on your computer.

hosts windows 7

What hosts file can be used for

Some users use it to prevent the possibility of using certain sites, such as pornographic or sites of annoying social networks. To implement this task, you can simply enter at the end of the file for each site one line of the type: 127.0.0.1 "site name". At the same time, sites by the name of which users on this computer are trying to go will simply not be called.
You can do this trick: redirect those trying to call an unwanted site to a site, for example, the Mashkov library by entering the line: 81.176.66.163 "site name".

where is the hosts file

Ad Exclusion

Also, the question of hosts, what should be there, is important because by making some additions to it, you can avoid showing boring contextual and / or banner ads, which in some sites are added not only along the perimeter of the information content of the pages, but also interspersed in the middle of the texts articles. To do this, redirect sites hosting these types of advertisements to 127.0.0.1, as described above. And these are sites such as, for example, Google adsense ads. To exclude its display, enter the following lines in the hosts file:

  • 127.0.0.1 pagead.googlesyndication.com;
  • 127.0.0.1 pagead2.googlesyndication.com.

And save the file. If you want to view this advertisement again, you must delete these lines or make them comments by putting a # (pound) symbol with a space at the beginning of the line.

hosts file

On the Internet, you can find ready-made texts for insertion into the hosts file, containing many of these lines, excluding the display of unnecessary advertising materials. In addition, there are ready-made texts for setting up faster work with some search engines, for example, hosts google. However, use such materials carefully. It is undesirable for hosts to exceed 10 KB in size. Otherwise, he will slow down the system. Although these 10 Kbytes can accommodate many of these lines of redirection.

Possible difficulties

First you need to make sure that the file you want to edit. The fact is that some cunning creators of virus programs mask the hosts file used by the system, placing it in the wrong place where it is registered by default. The system accesses the Windows 7 hosts file, the path of which is registered in the registry in the DataBasePath parameter located at: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ Tcpip \ Parameters \.

The correct path value is:% SystemRoot% \ system32 \ drivers \ etc \ hosts. You can verify this by calling the registry editor regedit.exe from the START menu - run.

If the specified variable contains a different value, you need to restore the value that should be.

Another trick of malware is to place another file with a similar name in the etc directory along with the hosts file, for example host. Be careful, make sure that you check and edit the exact file that is used by the system.

The third trick is to hide the file for viewing. Just in the properties of the file they prescribe that it is hidden. In this case, it is simply not visible in the catalog, although it is present there. To view it, you must first set the item "Show hidden files." In Windows XP, this option is set in the View tab of the Properties panel of the Control Panel menu folder. After that, viewing hidden files will be possible, and it will be possible to reset the “hidden” sign in the properties of this file. At the same time, check whether the "Read only" flag is set for this file. If installed, then you will not be able to edit it. It is necessary to uncheck the corresponding field of the file properties panel.

hosts google

The next trick may be to use a proxy. If manual proxy configuration is installed, then the hosts file does not work. To fix this, check your browser settings. For example, for Firefox you need to open "Settings", then "Advanced", then in the "Network" tab, select "Configure". In the menu that appears, if the option “Use system proxy settings” was selected, select “Without proxy” and save the settings. But if the option "Manual proxy service configuration" was selected, but you did not install it, then more work needs to be done. First you need to remember the set proxy server address, set the item “Without proxy”, save the settings. Then you need to open the registry editor, call a search, insert the stored address and search by deleting the value of your address assigned to them in the keys found.

Simple protection

By the way, in order to prevent malware from changing the settings of the hosts file on your computer, it is useful to set the Read-Only attribute in its properties (after all your changes to it).

Thus, in this article we figured out the question about Hosts, what should be there, and found out what kind of file it is, where it is located, what functions it performs, how it can harm the computer under the influence of malware, and how to use it in our purposes.

Source: https://habr.com/ru/post/C34720/


All Articles