Where is the hosts file in windows 8. Clean hosts file. Creating a shortcut for editing hosts


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 such as 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 everything that exists, the Internet is far from what it seems to the average user at first glance. The average owner of a personal computer or laptop is used to opening a browser, entering a query in the search bar and receiving the information found or the necessary Internet page. But in fact, the PC had to do much more work than the user noticed.

As soon as the desired query 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 the Internet page. Once the request has been sent and the necessary information has been received, the connection to the website server and direct downloading begins.

The hosts file in Windows 8 plays the role of a protective membrane through which specified IP addresses are passed and unknown ones are cut off.

It has local significance and its own 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, with the appropriate knowledge and skills.

It is through this file that you can prohibit connections to certain servers, which will allow you to deny access to content that is undesirable for the user. Also, editing it can be used as “parental control”.

Setting details

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

The first thing worth mentioning is that this file is the most common target for virus and spyware. The malicious program tries to make changes and add new entries that allow you to connect not to the desired website, but to a pre-prepared one that will sabotage your 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 realize that he did not go to the VKontakte page, but to a completely different server, since the address bar will contain the words “vk.com”.

The hosts file, due to its importance, is under the protection of a service such as Windows Defender, which does not allow you to make adjustments to it or add new entries.

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

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

Hosts adjustment

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 required object is impossible if:

  • Windows Defender protection was not removed. All changes simply will not function, since the operating system will refuse to make adjustments and save them.
  • No third party antivirus software was 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 key he needs and save the changes.

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

First of all, you need to launch standard Notepad or any other simple text editor.

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

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

Once the data is entered, all that remains is to save the changes and check the results of the work.

Hosts file in Windows 8: Video

Vladimir Skesov

Well, I think you have already noticed that when you try to save a system file hosts(C:\Windows\System32\drivers\etc\hosts), the new operating system complains and does not allow you to save the desired changes. This is to blame for the tightening of security rules applied in the eighth series operating systems. Of course, this makes sense, since many viruses write the lines they need into this file, and all antiviruses have long been required to check this file for these changes. But what should we, ordinary users, do? We want, for example, to simply turn off advertising in Skype. It's quite simple: we need to open this file in a program running as administrator. And there are several ways to do this:

I. Editing the hosts file using the command line.

1) Right-click on the lower left corner and select “Command Prompt (Administrator)”:

2) In the window that opens, write (or copy) the following text:

notepad C:\Windows\System32\drivers\etc\hosts

3) The most common Windows notepad will open, but it will be launched with administrator rights and will allow you to make changes to the hosts file:

An alternative to the first method:

Download the editHOSTS.cmd file. Right-click on it, select “Run as administrator” and edit the file in the notepad window that opens.

II. Open a text editor with administrator rights manually.

1) Fundamentally, this method does not differ from the previous one, but now we need to go to the folder in which the executable file of the text editor is stored, for example Windows Notepad (this part of the instructions is also suitable for other text editors, for example Notepad++) is located in:

C:\Windows\system32

In this folder you need to find the file notepad.exe:

2) Click on notepad.exe right-click and select "Run as administrator":

3) Select "File" → "Open". In the window that appears, go to the folder with the file hosts(C:\Windows\System32\drivers\etc\). Select "All files" in the lower right corner and open

When connecting to a website, your computer first contacts the DNS domain name server and requests the IP address of the desired site. For example, the website Facebook.com has an IP address of 66.220.158.70. Your computer then connects to the identified IP address and accesses the site.

Your hosts file is a file local to your computer that can modify 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 link Facebook.com to 127.0.0.1, which is your local IP address. Subsequently, when someone tries to access Facebook.com from your computer, your computer will try to connect to itself. However, it will not find your web server, and therefore there will be no connection.

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

Why did Microsoft change how it works with the hosts file?

Unfortunately, the hosts file is often edited by malware, adding various lines to it. For example, a Trojan can “link” 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 realize that they are on a phishing site.

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

For many users, this behavior of the operating system is very important, because it is aimed at their own security. However, if you like to do everything yourself, you can disable tracking changes to the hosts file.

Since Windows Defender monitors hosts file changes, you can:

  • Exclude hosts file from Windows Defender tracking. 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 an antivirus from a third-party developer. Many third party antiviruses won't be as aggressive with your hosts file. When you install a third-party antivirus, Windows Defender will turn itself off.

You can also disable Windows Defender completely, but this is not a good idea (unless, of course, you install a third-party antivirus afterwards). Even as a cautious user, having multiple layers of protection is a good security practice.

Excluding the hosts file from Windows Defender tracking

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

On the left, select Windows Defender from the search results and open the application.

On the Options tab, in the Excluded Files and Locations section, click 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 will not ignore the changes you made.

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 saying that you do not have sufficient rights.

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

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

In the editor, click on the File -> 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 your own line for each site to be blocked. Type 127.0.0.1 then press the spacebar or tab 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 websites will be blocked - no system reboot required.

That's all! Good luck to you!

What is the Hosts file for?
The purpose of this system file is to assign certain website addresses to a specific IP.
This file is very popular with all kinds of viruses and malware in order to write their data into it or simply replace it.
The result of these actions may be signs of “insertion” of a site into browsers, which will ask to send an SMS when opening the browser, or blocking of various sites, at the discretion of the creators of the virus.

Where is the hosts file in windows?
For different versions of Windows OS, the location of the hosts file is slightly different:

Windows 95/98/ME: WINDOWS\hosts
Windows NT/2000: WINNT\system32\drivers\etc\hosts
Windows XP/2003/Vista/Seven(7)/8: WINDOWS\system32\drivers\etc\hosts


Moreover, the ending hosts, this is already the final file, not a folder. He doesn't have it.

What should the correct hosts file look like?
The “contents” of the hosts file are also slightly different for different versions of Windows, but not much. It “writes” in English why it is needed and how to make exceptions, giving one example. All lines starting with a # sign mean that they are commented out and do not affect the file.
Contents of the original hosts file for Windows XP:


#

#




#space.
#


#
# For example:
#



127.0.0.1 localhost


Contents of the original hosts file for Windows Vista:

# Copyright (c) 1993-2006 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
127.0.0.1 localhost::1 localhost


Contents of the original hosts file for Windows 7:

# 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handle within DNS itself.
#127.0.0.1 localhost
# ::1 localhost


Contents of the original hosts file for Windows 8:

# 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
#127.0.0.1 localhost
# ::1 localhost


As you can see, there are no significant differences in the contents of the host file for different versions of Windows.

How to open and edit the hosts file?
The hosts file can be found in standard Windows Notepad.
This is probably the most interesting part of the article.
First of all, you need to understand why change this file at all? Yes, in order to deny access to certain sites. Thus, by changing this file and writing the site address into it, the user will not be able to access it through any .
In order to change the hosts file, it is advisable to open it as administrator () by right-clicking on the file and selecting "Run as administrator". Or open Notepad this way and open the file in it.

For quick action, you can simply click the Start button and select Run ( win+r) () and enter in the line:

notepad %windir%\system32\drivers\etc\hosts



As a result, this file will open in Notepad.

In order to block access to the site(let's assume it will be test.ru), you just need to add a line with this site at the very bottom:

127.0.0.1 test.ru


As a result, the file will have the following content:

# 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 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:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# This HOSTS file created by Dr.Web Anti-rootkit API

#127.0.0.1 localhost
# ::1 localhost
127.0.0.1 test.ru


Each new site that you want to block must be started on a new line and entered, not forgetting the local IP address 127.0.0.1

Also, to edit the hosts file, there is a program HOSTS EDITOR, which you can download and read the description from.
The way it works is that it helps edit the hosts file.
From the screenshot below the principle of its operation is clear; everything is done in a couple of clicks. Adding is done by clicking on +.


After editing, do not forget to click on the save button (2 button "Save changes" to the left of the "+" button).

You can also change this file for good purposes, for example speed up site loading.
How it works?
When you visit a site, you see its domain name, which has letters. But all sites on the Internet have an IP address, and names are already assigned using DNS. I won’t go into details of this process; that’s not what the article is about. But here you need to know that the hosts file has priority when accessing sites, and only after it does a request to DNS occur.
In order to speed up the loading of a site, you need to know its IP address and domain.
The IP address of a site can be found using various services, for example or.
A domain is the name of a website.
For example, let's speed up the loading of this site where you are reading an article by explicitly specifying the IP address and domain to the file.
Then the added line will be:

91.218.228.14 website


This speeds up page loading in a couple of seconds, and sometimes can give access if you cannot access the site using standard means.

Still possible redirect to another site using hosts file.
To do this, you need to know the IP address of the site and its domain (as in the case described above), then the added line will be like this:

91.218.228.14 test.ru


And now, after entering test.ru into the address bar of your browser, you will be redirected to the site specified in the IP address..

If you want to clean hosts file, then you can do this by simply deleting the content and inserting the original text from the description above (under spoilers).

Some nuances in the hosts file:

  • Always make sure you have a scroll bar on the side and always scroll to the bottom of the window. This is due to the fact that some viruses are registered in an area hidden outside the window.
  • In some cases, usually if you cannot save the file, you need to log in under the Administrator account.
  • Sometimes, due to viruses, this file may be hidden. Read the article.
  • The two methods described (redirection and acceleration) may not produce the desired result. The fact is that several sites can be located on one IP address, this is especially true for external IP addresses provided by services.
  • Due to the fact that viruses love this file, its attributes can be changed to Hidden And Read-only.
  • Check the file attributes if the hosts file cannot be saved.

    Thus, you can easily and free of charge block access to sites in Windows by editing the hosts file.

  • The hosts file is a system file. When you try to open a website, your computer first contacts the DNS server and requests the IP address of the site you want to go to. But hosts has priority over the DNS server, that is, the computer will contact it first. 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 programs for which you picked up the keys on the Internet. This is necessary so that the program continues to work normally and the key does not fall off.

    But let's deal with everything in order.

    Change

    In order to edit 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” from the side pop-up panel.

    Write “Notepad” in the search bar.

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

    The one we need is located on the computer at the following path: . At the bottom right, select “All files”, select the one you need with the mouse and click “Open”.

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

    Recovery

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

    Windows 8/8.1/10

    Editing

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

    When you try to access this address through a 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 the site address you entered has an IP address in the file, 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 a computer to the vk.com website, an error will appear, since it will try to connect to itself, and not to the real IP address of the site.

    If the hosts file has been modified by viruses, then various addresses and sites may also be written below. And when you try to log into Instagram, for example, 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 into the hands of scammers. Delete suspicious fields and save the changes: “File” - “Save”.

    If you want to specifically block 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, or any other. Then save your changes.

    Windows Defender File Tracking

    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. After all, in case of infection with viruses, it will immediately inform you about the changes that they can make. But what to do if you yourself want to block access to certain sites.

    The most radical way is to completely exclude the hosts file from the protection list. The system will not check it, and there is a possibility of it being modified by malware that you will not even know about. But it can be done. 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, line 127.0.0.1 vk.com will be deleted from the file. Then click "Apply Actions".

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

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

    Rate this article:




    

    2023 maximum03.ru.