Computer users are rarely trying to understand working principles of the various functions of the operating system they use. Most people know that to connect to the Internet via wire or Wi-Fi, it is enough to enter a login/password and enter your request in the browser. But in fact the principle of Internet operation is much more complicated. An important role in connecting your computer to the Internet is played by the system hosts file in Windows, and this file is often attacked by virus software. In this article we will tell you what the hosts file should look like, where to find it in Windows, how to change it, and which tasks is it responsible for.
Table of contents: 1. Why do you need hosts file in windows? 2. Where is hosts file in windows 10, windows 8? - First method - Second method 3. How to change file hosts in windows? 4. How the hosts file should look like?
Why do you need hosts file in windows?
In Windows operating system the hosts file can be called a kind of “Instruction for connecting to the Internet”. Its main task is to convert the incoming symbolic information about the requested domain into the required IP address. When you connect to a specific website on the Internet, the symbolic request is converted to the IP address of the server that your computer is supposed to connect to. Hosts file is responsible for this conversion, and the computer’s request to this file is a bigger priority than the request to the DNS servers.
After examining the hosts file functions, virus developers are constantly trying to use it for their own purposes. In particular, in this file you can write information that will prevent one’s computer from connecting to a specific IP address or website. Most often, cybercriminals block access to popular social networks or websites containing anti-virus software through a computer’s hosts file.
Also there is a quite common way of deceiving a user by replacing information about the IP address that the browser should connect when entering a specific domain name of the site, and this replacement takes place exactly in the hosts file. This way some attackers direct one’s computer to a website that looks like a requested resource — for example, a popular social network. Inattentive user enters his login and password in the window that appears, but this information will be sent directly to the attacker.
To get rid of problems with unwanted redirects to malicious websites, you should keep the hosts file in proper condition and edit it if necessary.
Where is hosts file in windows 10, windows 8?
Since the hosts file is a system file, and it is installed with the Windows operating system, you should look for it in the appropriate folder. There are two ways to find the hosts file on your computer.
Open a search on your computer, enter “documents: hosts” as a search query and start searching for the required file. This method of searching the hosts file has one significant drawback – it takes up a significant amount of time. If the computer has a large hard drives clogged with information, looking for the hosts file may take dozens of minutes, and even more than an hour. To shorten the file search time, you can designate an approximate disk (or folder) where it is located.
The second method is much simpler – just go to the folder where the hosts file is located. Location of this file in Windows does not change from one version to another – it is always located at the address “C: \ Windows \ System32 \ drivers \ etc”. If your system disk (that is, the disk where the operating system is installed) is not C, then, accordingly, you should look for the appropriate one, and not as shown in the example.
How to change file hosts in windows?
In Windows operating system you can change the hosts file values only if you access it on behalf of the administrator. Many virus programs do this without problems, while users often forget that they can only change system files when they are accessing on behalf of the computer administrator. Here is a simple instruction on how to change the hosts file in Windows:
- Click on the “Start” button, go to the “All Applications” tab, scroll down to the “Windows Accessories” item, open this item and right-click on the “Notepad” program. Select the “Run as administrator” item. The operating system will ask you to confirm that you want to run the file as an administrator – click “Yes”.
- Next, in the appeared notepad, click “File” – “Open …” and go to the folder where the hosts file is located. As we have already noted above that this file is most often located at: C: \ Windows \ System32 \ drivers \ etc. To see the file through Notepad, do not forget to select “All files” in the lower right corner. After the hosts file was found – open it.
Now you have an opportunity to change the hosts file in Windows, since it is opened through Notepad, which you run as administrator. Many users make one same mistake when they open the hosts file without administrator rights – they change it, but the information in the file after saving remains the same.
How the hosts file should look like?
If the virus software has changed the hosts file, you should change the information in it to the standard one in order to be able to connect to all websites on the Internet again. After you run the hosts file as an administrator, you need to verify the information in it. Below you can see how the hosts file should look like if it remains unchanged. The easiest way is to copy the presented code and completely replace the one that is in your hosts file.
This is what you should be able to see in the hosts file:
# Copyright (c) 1993-2009 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 followed by the corresponding host name. # 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: # # 18.104.22.168 rhino.acme.com # source server # 22.214.171.124 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost
Attention: Virus software is becoming more and more advanced, and if at first glance it seems to you that the hosts file on your computer completely coincides with what is presented above – this may not be the case. For example, sometimes a virus changes English letters to the similar Russians ones or the number 0 to the letter O. Also a common way of manipulating the hosts file is to add information about prohibiting access to some websites well below the area that is visible to the user.
Note that if after changing the hosts file some unwanted lines were added to it again, you should check your entire computer for viruses that can replace the native system file with their own immediately after the user has made adjustments.