HOSTS file (Windows 7): contents, purpose, recovery

Few users working with the "seven" and surfing the Internet, guess the true meaning of the HOSTS file (Windows 7). Its contents will be shown a little later, but for now we dwell a little on theory.

HOSTS file: why is it needed?

In general, if anyone paid attention, the file itself is located in the etc directory, if you go sequentially through the tree from the Windows folder, through System32 to the drivers directory on the system drive. Not everyone, however, goes into such a jungle of the system, by and large, this is not necessary. On the other hand, if you pay attention, the extension object itself does not have, although, in fact, it is an ordinary text document.

hosts windows 7 content

But let's take a closer look at the Windows 7 HOSTS file . Its contents are such that it is this object that is responsible in the system for the relationship between host names (sites, nodes, etc.) and the determination of their IP addresses to provide the end user with access to the resource. Roughly speaking, we do not need to register combinations consisting of numbers in the browser, but we can specify only the names of the resources.

And one more small clarification about the HOSTS file (Windows 7). Its contents may vary. Depending on what changes were made, this can help block certain sites, speed up access to certain resources, or it can, on the contrary, play a cruel joke, redirecting the user to questionable sites. However, first look at the original file.

HOSTS File (Windows 7): Contents

So, for starters, let's try to open this object. I must say that if you use the standard double-click method, nothing will work, because, as mentioned above, this object does not have an extension. In addition, the file can be hidden, so you should first select the display of hidden objects in the view menu. But the system will offer several applications for opening. We select the simplest one - the standard Notepad and look at the contents of the HOSTS file (Windows 7). Before us is something incomprehensible: descriptive text, some examples and a line indicating the local IP (# 127.0.0.1 localhost). It should be so.

contents of hosts windows 7 file

Attention! Below the line indicating the reserved local address there should be nothing at all, unless, of course, the user does not want a resource to be blocked!

In general, everything above localhost refers to allowed resources. All that is lower - to blockable. It is easy to guess that many viruses, in particular programs that distribute spam or ads (Malware, Adware, etc.) independently edit the contents of this file. So it turns out that when requesting one resource, the user receives a redirect (redirection) to a completely different one.

Restore HOSTS file to default in Windows 7

We reviewed the original file. Now we will analyze the changed content. To fix it, you can take the contents of a “clean” file for the “seven” from another computer or from the Internet, copy it, then paste it into the original and save.

But there is one problem. The fact is that sometimes after deleting everything unnecessary, saving the file as the original does not work (the system simply does not allow this).

restore default hosts file in windows 7

What to do in this case? First, delete the original completely (Shift + Del), bypassing the "Recycle Bin". Then we use the right click on the empty space inside the etc directory and create a new file with the same name, but do not specify the extension. Now we insert the necessary contents into it and save the object. After that, there you need to find the lmhosts.sam file and delete it, as mentioned earlier.

All done. That in the first, that in the second case, a system restart is required. Only then will everything work as expected. And, of course, editing should be done exclusively with admin rights.

Total

In general, very brief information about the HOST file was provided here. If you look at the issues of blocking some unwanted resources or, conversely, permissions to visit them with faster access, editing should be done exclusively manually and in accordance with certain rules. It must be remembered that the key role of the separator is played by the line specifying the reserved local IP. Well, then, as they say, a matter of technology. By the way, the above method will help if the contents of the object were changed due to the influence of virus programs.

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


All Articles