How to edit the hosts file in windows 8. Clean hosts file. How to open the hosts file

Of course, the performance of any operating system has its own subtleties and nuances, and this is especially true for everything related to the Internet. And a file like hosts in Windows 8 is no exception.

Special purpose

To understand how to edit hosts in Windows 8, you first need to understand why such a file is needed at all and what it is responsible for.

Like most of everything that exists, the Internet is far from what it seems to an ordinary user at first glance. The average owner of a personal computer or laptop is used to opening a browser, entering a query into the search box and getting the information found or the required Internet page. But in reality, the PC had to do a lot more work than the user had time to notice.

As soon as the required request or address has been entered, the system turns to one important tool - the DNS server. It is responsible for determining and issuing IP addresses to websites and plays the role of a kind of buffer between a certain personal computer with its operating system and an Internet page. After the request has been sent and the necessary information has been received, the connection to the website server and the direct download begins.

The hosts file in Windows 8 acts as a protective membrane through which specified IP addresses are passed and unknown ones are cut off.

It has a local meaning and an original copy is created on each device with an operating system from Microsoft. And, despite the fact that in most cases it has the same parameters, anyone can change them at their own discretion, of course, if they have the appropriate knowledge and skills.

It is through this file that you can prohibit connection to certain servers, which will allow you to deny access to unwanted content for the user. Also, editing it can be used as a "parental control".

Subtleties of setting

Before describing where the hosts file is located in Windows 8, you should describe the nuances associated with it.

The first thing to mention is that this file is the most common target for virus and spyware software. The malicious program tries to make changes and add new entries that allow it to connect not to the desired website, but to a previously prepared one that will engage in sabotage of the PC. The effect will depend on the intended purpose of the virus, its type and the tools at its disposal. Thus, the owner of the device may not even know that he went not to the VKontakte page, but to a completely different server, since the address bar will contain the inscription “vk.com”.

The hosts file, due to its importance, is protected by a service such as Windows Defender, which does not allow you to make adjustments to it and add new entries.

When installing third-party antivirus software, this service is disabled, and the newly installed utility controls the hosts. The degree of control decreases, as the third-party application is more loyal to working with local data.

If necessary, the user can remove the Guardian's custody of this file, but this should only be done by experienced users who understand what this can lead to. To do this, open Windows Defender, go to the "Options" tab, and then select the file of interest in the block of excluded files and locations, which is located at the address: C: WindowsSystem32Driversetchosts.

Hosts correction

At the preparatory stage, you will have to perform one small but very important action, without which further manipulations simply do not make sense. Editing the desired object is impossible if:

  • Windows Defender Trustee has not been removed. All changes will simply not function as the operating system will refuse to make adjustments and save them.
  • No third party antivirus software has been installed. It has noticeably fewer tools in the environment than the native Defender, and therefore its control will be less soft. This, in turn, will allow the PC owner to correct the file in the desired key and save the changes.

Having finished with the preparatory stage, you can proceed to the main procedure.

The first step is to launch a standard Notepad or any other simple text editor.

As soon as the corresponding window is displayed on the monitor screen, in the upper right corner, select the "File" tab, and then the "Open" position and follow the address already mentioned.

Once the file is open, you can start adding new parameters. To do this, you need to go down to the end of the records and, from a new line, first add your local IP, and then the Internet address of the resource itself. The local IP address has a general meaning and looks like this in standard form: 127.0.0.1.

As soon as the data is entered, it remains only to save the changes and check the results of the work.

Windows 8 hosts file: Video

The hosts file is a system file. When trying to open a website, the computer first contacts the DNS server and asks for the IP address of the website you want to go to. But hosts takes precedence over the DNS server, that is, the computer will first contact it. DNS is a remote server and the hosts file is stored on the user's computer and can be changed by the administrator.

Unfortunately, viruses and malware installed on your computer can change its contents. It also stores the IP addresses for the activation servers of those applications, the keys for which you picked up on the Internet. This is necessary so that the program continues to work normally and the key does not fly off.

But let's deal with everything in order.

Change

In order to change the hosts file and then save it on your computer, your account must have administrator rights. Otherwise, when you try to save the edited file, a window will appear with a message that you do not have enough rights. Now you need to open Notepad, also with administrator rights. In Windows 8, to do this, move the cursor to the upper right corner and select "Search" in the side pop-up panel.

In the search bar, write "Notepad".

In Notepad, go to the File tab and select Open.

The one that we need is on the computer along the following path:. At the bottom right, select "All files", select the desired one with the mouse and click "Open".

In the Windows 7 / 8.1 / 10 operating system, it can be found along the same path. The main thing is to open it in Notepad or Notepad ++ with administrator rights.

Recovery

After you have opened it, take a close look at the contents. By default, it should say the following.

Windows 8 / 8.1 / 10

Editing

At the bottom, various IP addresses and their corresponding site names can be written. For example, in the picture below, access to VKontakte is blocked.

When you try to enter this address through the browser, you will see the following message.

The fact is that before requesting an IP address for vk.com (or any other) on the DNS server, the computer first looks at the hosts file. If an IP address is registered in the file for the site address you entered, it goes to it. In the example, 127.0.0.1 is the local IP address of the computer. Therefore, when you try to connect your computer to the vk.com site, an error will appear, since it will try to connect to itself, and not to the site's real IP address.

If the hosts file has been modified by viruses, then various addresses and sites can also be registered below. And when you try to go to, for example, Instagram, you will be taken to a site with advertisements. Or in general, nothing will look different, but the data from the login and password fields will not be sent to the Instagram server, but directly to the scammers. Remove suspicious fields and save changes: "File" - "Save".

If you want to specifically deny access to certain sites, first enter IP 127.0.0.1 or 0.0.0.0, and then the name of the site: www.yandex.ua, well, or any other. Then save your changes.

File tracking by Windows Defender

After I made changes and blocked access to VKontakte in Windows 8, a message appeared.

This means that Windows Defender monitors any changes that are made to hosts. This is certainly a plus for the user. Indeed, in case of infection with viruses, he will immediately inform you about the changes that they can make. But what if you yourself want to deny access to certain sites.

The most radical way is to exclude the hosts file from the protection list altogether. The system will not check it, and there is a possibility that it will be modified by malicious programs that you will not even know about. But you can do it. Go to the "Options" tab - "Excluded files and locations"... Then click on the "Browse" button and find the hosts file on your computer: C: \\ Windows \\ System32 \\ Drivers \\ etc... Click "Add", then "Save changes".

There is another way. To do this, click on the button Show details.

In the next window, in the field Recommended Action, you can choose what to do with the threat. If you made changes to the file yourself, select "Allow". If you select "Delete", then, in my case, the line 127.0.0.1 vk.com will be removed from the file. Then press "Apply actions".

Wait for the process to finish. Windows Defender windows will look like this.

That's all. In this article, we figured out what a hosts file is, how you can change it, restore its contents, edit it, and how you can disable a file from the Windows Defender list.

Rate article:

In the Windows 8 operating system, the file hosts is in the following path:
C: \\ Windows \\ System32 \\ drivers \\ etc \\ hosts... This is a plain text file that stores the ip-addresses of domain names on the local machine and is manually generated by the computer's administrator if necessary. However, malware also likes to use this file, so you need administrator rights to edit the hosts file.

etc folder with hosts file

Although this file is a text file, it does not have the usual .txt extension, so the operating system will ask which program to open it. In the window that appears, find and select Notebook.


Choosing Notepad

You can also open the hosts file for editing in Windows 8 with another editor, for example, the widely used Notepad ++.


Notepad window


If the above algorithm fails, you may not have sufficient access rights. Find in the folder C: \\ Windows \\ System32 \\ file notepad.exe and call the context menu with the right mouse button, where we select. And then through the File-Open menu we find the hosts file in the folder C: \\ Windows \\ System32 \\ drivers \\ etc \\.

We make the necessary changes and save the file. As you can see, all actions are the same as in the case of editing.

When connecting to a website, your computer first contacts the DNS domain name server and requests the IP address of the desired website. For example, Facebook.com has an IP address of 66.220.158.70. Then your computer connects to the learned IP address and gets access to the site.

Your hosts file is a file local to your computer that can change the above behavior. By editing the hosts file, you can bind Facebook.com to any IP address you want. Some people use this trick to block websites.

So, for example, you can bind Facebook.com to 127.0.0.1, which is your local IP address. Subsequently, when someone tries to contact Facebook.com from your computer, your computer will try to connect to itself. However, it will not find the web server for you, and therefore there will be no connection.

In a similar way, the connection of programs to the activation servers is blocked so that the "left" keys found on the Internet do not stop working.

Why did Microsoft change how the hosts file works?

Unfortunately, the hosts file is often edited by malicious programs, adding various lines to it. For example, a Trojan can "bind" Facebook.com to a completely different IP address, which will host a specially prepared hacker server that can impersonate the real Facebook.com. The user will see the name Facebook.com in the address bar and will never even guess what is on the phishing site.

To prevent this, Windows 8 (or more accurately Windows Defender in Windows 8) monitors your hosts file. When you add a site like vk.com to it, the operating system immediately deletes the new entry and thereby ensures your connection to the normal site vk.com.

For many users, this behavior of the operating system is very important, because it is aimed at their own security. However, being a fan of doing everything yourself, you can disable tracking of changes in the hosts file.

Due to the fact that Windows Defender is responsible for tracking changes in the hosts file, you can:

  • Exclude hosts file from being tracked by Windows Defender... This is the best way. However, using it will mean that Windows will no longer protect your hosts file from being modified by malware.
  • Install a third-party antivirus... Many third-party antiviruses will not treat your hosts file as aggressively. When installing a third-party antivirus, Windows Defender will turn itself off.

You can also disable Windows Defender entirely, but that's not a good idea (unless, of course, you install a third-party antivirus after that). Even as a careful user, having multiple layers of protection is a good security practice.

Exclude the hosts file from being tracked by Windows Defender

To exclude the hosts file from being tracked by Windows Defender, first open Windows Defender itself. To do this, search for Windows Defender.

On the left, in the search results, select Windows Defender and open the app.

On the "Options" tab in the "Excluded files and locations" section, click on the "Browse" button and navigate to the following file:

If you installed Windows in a different folder, start there instead of C: \\ Windows.

Click on the "Add" button and save the changes.

Now you can edit your hosts file and Windows won't ignore your changes.

Editing the hosts file

You will have to edit the hosts file as an administrator. If you try to edit it in the usual way, when saving you will see an error message with the words about insufficient rights.

To run Notepad as administrator, right-click on it and select the option to run as administrator from the menu that appears.

By the way, you can also use any other editor like Notepad ++ to edit the hosts file.

In the editor, click on the File -\u003e Open menu and navigate to the following file:

C: \\ Windows \\ System32 \\ Drivers \\ etc \\ hosts

In the file selection window that opens, you need to select the "All files" option from below, otherwise you will not see the hosts file.

After opening the file, add a line for each blocked site. Type 127.0.0.1 then press the space or tab key and then write the name of the website. So, for example, the following lines will block facebook.com and vk.com:

127.0.0.1 facebook.com

127.0.0.1 vk.com

After editing, save the file. The changes will take effect immediately and the websites will be blocked - no system restart is required.

That's all! Good luck to you!

In some situations, you may need to change the hosts file in Windows 10, 8.1 or Windows 7. Sometimes the reason for this is viruses and malware that make changes to the hosts, which makes it impossible to access certain sites, and sometimes you yourself may want to edit this file in order to restrict access to any site.

This instruction details how to change hosts in Windows, how to fix this file and return it to its original state by built-in system tools and using third-party programs, as well as some additional nuances that may be useful.

Many third-party programs for fixing network problems, customizing Windows, or removing malware also include the ability to modify or fix the hosts file. Here are two examples. In the free DISM ++ program for configuring Windows 10 features with many additional features, there is an item called “Hosts Editor” in the “Advanced” section.

All he does is launch the same notepad, but with administrator rights and the desired file open. The user only needs to make changes and save the file. Read more about the program and where to download it in the article.

Considering that unwanted changes to the hosts file are usually the result of malicious programs, it is logical that the means for removing them may also contain functions for correcting this file. There is such an option in the popular free AdwCleaner scanner.


It is enough to go to the program settings, enable the "Reset hosts file" item, and then scan and clean on the main AdwCleaner tab. The process will also fix hosts. Read more about this and other such programs in the review.

Create a shortcut to change hosts

If you often have to fix hosts, then you can create a shortcut that will automatically launch notepad with an open file in administrator mode.

To do this, right-click on any free space on the desktop, select "New" - "Shortcut" and in the "Specify object location" field enter:

notepad c: \\ windows \\ system32 \\ drivers \\ etc \\ hosts

Then click Next and provide a name for the shortcut. Now, right-click on the created shortcut, select "Properties", on the "Shortcut" tab, click the "Advanced" button and specify that the program is run as administrator (otherwise we will not be able to save the hosts file).

I hope some of the readers find the instruction helpful. If something does not work out, describe the problem in the comments, I will try to help. Also on the site there is a separate material:.