Where to find hosts windows 8. Clean hosts file. Path to the hosts file and opening it

Hosts (domain database) is a small document located in the Windows system folders. When you go online and or simply navigate to a website through your browser bookmarks, Windows accesses it first. The main purpose is to compare website names (domains) and their IP addresses, written in numbers. You can go to the site by entering the domain or IP.
It is vulnerable to viruses and other malware that seek to overwrite it

This is done so that you are automatically taken to advertising and virus sites or to block the ability to download certain Internet services. But fortunately, the contents of Hosts are under the control of the user. A notepad program is enough to enter data into a text book or rid it of unnecessary things. Read on to learn how to change hosts in Windows.

How to open Hosts

There is a host database in any OS that can connect to the Internet. And in Windows, and in MacOS, and in Linux distributions. But the location is very different. In XP, Vista, 7 and 8, 8.1 and 10 hosts file located at C:\Windows\System32\drivers\etc. You can open it directly in Explorer. The system32 folder is located directly in Windows.

But it’s easier to open the command line from the list of standard programs and enter this in the window: notepad C:\windows\system32\drivers\etc\hosts and press Enter.

Run the command line with administrative rights, otherwise only viewing will open and changes will be blocked.

It will launch in the usual notepad. If the command line was initiated from the admin, then the notepad will open in the same way and you can make edits.

There is a third way to open the hosts file in Windows 7, 8, 10 - for the curious:

  1. in Explorer go to C:\Windows\system32;
  2. you need notepad.exe;
  3. right click on it and click on run as administrator.

Next, in a simple way: “File” -> “Open” and look for the one you need. For Notepad to see it, you will need to enable the “All files” option in the lower right corner of the window. So, we figured out how to open hosts as an administrator, it’s time to understand how to edit it and why it is needed.

How to change hosts in Windows 8 or 8.1

The contents of hosts in Windows 7, 8 and 8.1 are the same and look something like this

If you know well English language, then at the top you can read a small text about the purpose of the file, but you will probably have it in Russian. We will edit bottom part, adding or deleting addresses.

Line 127.0.0.1 localhost is the local machine you are working on. If your computer does not have an http server running, you can use the address 127.0.0.1 to block unwanted sites. Add the line 127.0.01 site.ru (address of the blocked resource). You can add as many such lines as you like.

The sites included in the list will not open in any web browser on the local machine

The method is suitable for blocking access to sites that are dangerous for children. For the changes to take effect, you need to save the hosts file. The computer needs to be restarted. If you succeed in changing the hosts file in Windows 7, the added sites will not work until you delete entries about them and save them. On the contrary, if a malicious program has added its own entries, you can delete them, thereby opening access to the desired sites or erasing entries about redirection to resources that steal passwords, extort money, or infect your computer.

Editing hosts in Windows 7

Changing hosts in Windows 7 is no different. It is located at the same address and can be edited with notepad using administrator rights. Sometimes it is not possible to change the hosts file. The reason is viruses: some rewrite and do not allow you to change the hosts. Therefore, before you try to rewrite and save, check your computer for viruses. It is advisable to use several programs in turn for an accurate result. There is a large selection of anti-virus scanners on the Internet that do not require installation on your hard drive.

Creating a shortcut for editing hosts

  • To quickly open the domain database, you can place a launch shortcut on your desktop.
  • Right-click on an empty desktop.
  • Next, you need to select “Create” -> “Shortcut”.
Fig.1. In the location of the object, write the line: notepad c:\windows\system32\drivers\etc\hosts

It means that the file at the specified address will be opened by Notepad.

  • Click “Next” and give the shortcut a name so that it opens the desired file with administrator rights.
Fig.2. Right-click on the finished shortcut again and in the shortcut properties go to “Advanced” and specify the requirement to run as administrator

Now you manage domains and IP addresses on your computer.

WATCH THE VIDEO

Now you know how to change the hosts file in Windows. Ask questions to the experts.

1. What are hosts for?

The task system file hosts is the storage of a list of domains (web addresses like site.ru) of various sites and their IP addresses. Thus, in the process of working with the Internet, domains are converted into their IP addresses and vice versa. Each outgoing request to open a particular Internet site is, in fact, a request to convert a domain to an IP address. This query is performed by the Internet DNS service. From the technical side of the Internet veil, there are no web addresses in literal expression like site.ru. They are used for the convenience of web surfing by users and reflect the essence of the site's themes. Designed to facilitate the exchange of data between different parts of the network, the DNS service converts domains into specific sets of numbers, also known as the IP addresses of each individual site.

The hosts file has priority over the DNS system. Before accessing this Internet service, browsers first check their cache, then receive information about the mapping of IP addresses to domains, which is contained in the hosts file of the Windows operating system. And only after this the request goes to DNS.

Some users make changes to the “hosts” in order to speed up the loading of their favorite sites. If you specify in it for individual sites the correspondence of IP addresses to their domains, you can get slightly faster access to these sites, since they will load in the browser window, bypassing the stage of sending a request and receiving data from the DNS service. But this method of optimizing Internet access is not necessary, since there is a browser cache with the highest access priority.

The need for intervention to change the contents of this file arises when it is edited by malware without the user’s knowledge. Hosts file - vulnerable Windows place, it is of particular interest to malware creators. By replacing the original system hosts file with its analogue, but with a ready-made list of false correspondences of IP addresses to their domains, Internet fraudsters thus implement a redirection mechanism that is beneficial to them. If we add a false correspondence of the IP address to the domain into the “hosts”, replacing the real IP address, for example, of some social network with the IP address of, say, a site with paid porn content, then every time we try to get into the social network we will actually end up on a porn site. But this is not the worst example of scammers manipulating hosts. Things will be much more difficult with filling out forms on phishing sites. In order to fish out confidential user data, for example, accounts in financial and online payment systems, logins and passwords for them, Internet fraudsters can replace individual web pages of these online systems with their own web pages, specially created for fraudulent purposes. Substitution of file data with redirection to another site is also used as a dishonest way to promote sites, to block social network pages and extort for unblocking money, to block access to web resources of anti-virus software products, etc.

Making changes to hosts is also practiced for the purpose of locally blocking access to certain sites. For example, within the framework of parental control.

Below we will look at how the processes of making changes to hosts are carried out in order to edit it to block individual sites, as well as to correct it if the content is replaced by malware. But first, of course, let’s find the file itself, open it and look at its original contents.

2. Path to the hosts file and opening it

To access hosts, you must have administrator rights. It is located in the Windows system directory along the path:

C:\Windows\System32\drivers\etc

You can also open this path with the command %systemroot%\system32\drivers\etc in the Run dialog box

To open a file, call up the context menu on it, select “Open with” (simply “Open” for Windows 7) and from the list of offered programs select the standard Windows notepad or any third-party notepad, if one is present in the system (Notepad++, AkelPad, etc.). P.).

If according to specified path(subject to the display parameter being set hidden folders and files in Explorer) there is no “hosts” file, this is a clear consequence of the tricks of malware that has penetrated the computer. Viruses and Trojans can sometimes move it to another location on the computer.

3. Contents of hosts

After opening hosts, we will see its contents in the form of informational information about the essence of this file. Of the correspondence between IP addresses and their domains, only one should be present in the original version of the file contents (without user intervention, without malware tricks) work record. This is a disabled IP address match current computer value "localhost", local host. The hash sign at the beginning of the line means that the prescribed correspondence does not affect anything, but simply exists in the prospect of being used or as a template.

4. Blocking access to individual sites using the hosts file

Editing “hosts” is one of the many ways to block access to individual sites. Against the background of the locking mechanisms offered by the regular parental control Windows and third party programs, editing hosts is simple and in a fast way restrictions on access to sites.

To block access to a specific site, first clear the cache of the browsers used on the computer, then in the hosts open in notepad below the existing entries, enter a redirection from unwanted sites to the local host like this:

127.0.0.1 site1.ru

127.0.0.1 site2.ru

127.0.0.1 site3.ru

Those. in each match, after the local IP address 127.0.0.1, we add the domains of unwanted sites separated by a space. After editing the contents of the file, click the menu “File” - “Save As”.

It will not be possible to save the newly created file directly along the path where it is located in the system directory. First, this file must be saved in any non-system folder (for example, in the “Documents” folder) as a regular text TXT file called “hosts”.

After saving, select this file, press the rename key F2, delete the “.txt” extension (along with the period) and press Enter.

We confirm the action.

We copy the newly created file, after which we go to the folder along the path of the original hosts file, which is indicated in paragraph 1 of the article. Before inserting the newly created hosts file, you need to decide what to do with this file in its current edition. As an alternative to deleting, you can use the same F2 key to rename the current file, adding a postscript to the name in the form of a serial number, date or other nuances. It will be something like backup copy hosts with some current settings, which you can always return to by giving the file the original name without a postscript.

We confirm the insertion of the new file with administrator rights.

After all these steps, the sites included in the blocking list will not open in any browser on the system.

In the future, to temporarily remove the lock, so as not to delete entire records, you must insert a pound sign at the beginning of the line of each individual match and save the hosts file as indicated above.

It is not recommended to create a huge list of blocked sites (more than a hundred) in hosts, so as not to slow down the operation of your computer with the Internet. When blocking large-scale web projects such as social networks, you must also take into account that they may be accessible not by one domain, but on several.

5. How to fix the hosts file

If, when you try to visit the desired site, some other one opens instead, or a message appears demanding money for unblocking a social network account, it’s time to fix the hosts. First, of course, you need to clean your computer from viruses and other malware. Only after this can you begin to correct the file. Fixing hosts means that you need to return its contents to its original state. There are several ways to do this.

One way to fix it is to manually remove strings of false matches between IP addresses and domains that were introduced by malware. Having opened the file in Notepad, we leave only the default matches, as indicated in the screenshot, and delete all other lines.

And save the file as indicated in the previous paragraph of the article.

Entries with false matches may be hidden outside the view of the standard notepad window, so you need to view the entire document by scrolling down to the very bottom.

Another option for fixing a file is to completely replace the existing content with the original text content. The source text of the file can be copied from the Microsoft support site, where options for different versions and Windows editions:

In the case of Windows 10, a variant of the source text of the hosts file for Windows 8.1 is used.

We copy the original contents of the file on the website, in Notepad press Ctrl+A to select the entire text of the document, then Ctrl+V to paste. We save the file as indicated in the third paragraph of the article.

If the file in the path specified in the first paragraph of this article is missing, it must be created there after neutralizing the malware. Open in notepad new document, paste the source text copied from the Microsoft support site, save the file and place it in the system directory where it should be.

Finally, last method file corrections are automatic. True, it is only available for Windows 7 and earlier versions of the system. By following the link above, on the Microsoft support website in the “Easy fix” block, download the Fix it utility.

We launch it, agree with license terms, click “Next”.

We wait for its completion and close it.

Reboot the computer.

The utility will automatically correct hosts and return its contents to its original state, including restoring the file if it was not found along the installation path due to malware tricks.

Have a great day!

What is a file hosts where it is located in the operating room Windows system 8 (8.1) and how to edit it?

What is a hosts file?

hosts is a file in text format containing a database domain names, which are broadcast in network addresses.

A bit of useful information:

Domain name is a set of characters in a human-readable form that defines the address of a network resource, for example, a website, Email etc. For example, my site is on the domain website.

Network address or IP address is the unique address of an individual node in computer network. IP addresses can be static or dynamic. For example, in the IPv4 protocol version, the IP address could be: 192.168.0.1 or 46.42.60.167.

So, in relation to personal computer, file hosts stores IP addresses of domain names on the local machine.
The file can be edited manually if necessary, but with administrator rights.
Like to make changes to this file and various malware.

In the Windows operating system (XP, Vista, 7, 8, etc.) the file hosts is located in the directory:

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

How the hosts file works

When the user dials search bar browser URL of a site and pressing the Enter key, the web browser does the following:

  • Checks in hosts file whether the entered name is the computer's own name (localhost);
  • If not, then the browser looks for the requested address (hostname) in the file hosts;
  • If a hostname is found, the browser contacts the corresponding IP address specified in hosts file;
  • If the hostname is not found in the file hosts, then the browser accesses the DNS resolver cache (DNS cache);
  • If a hostname is found in the cache, the browser looks up the IP address stored in the DNS cache for that host;
  • If the hostname is not found in the DNS resolver cache, the browser contacts the DNS server;
  • If the requested web page (site) exists, the DNS server translates the user-specified URL into an IP address;
  • The Web browser downloads the requested resource.

How to open the hosts file?

Find and open file hosts in Windows 8 it's not difficult. You can walk along the entire path, as they say, manually. Open drive C, go to Windows folder... and so on.
For convenient searching, it is recommended to use Windows Explorer , because file managers(For example, Total Commander) for some reason they don’t see him. To call Explorer, you need to press the Start button or the Windows key or the key combination Ctrl+Esc. Copied file address hosts you need to paste into the search field:

You can just as easily use the Run window (Windows+R):

You can turn to the third option. Hover your mouse over the upper or lower right corner of the screen, calling up the vertical menu, and click on Search:

This file is nominally a text file, but does not have the usual extension .txt, That's why operating system will offer options for opening it. In the window that appears, find and select Notebook, and better, Notepad++:

For example in a text editor Notepad++ The hosts file for Windows 8 will look like this:

I tried to translate the contents of the file and this is what I got. Please read carefully, as the contents of this file contain basic filling rules hosts.

# Copyright (c) 1993-2009 Microsoft Corporation.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains mappings of IP addresses to hostnames.
# Each entry should be stored on a separate line.
# IP address must be in the first column, followed by the corresponding hostname.
# IP address and hostname must be separated by at least one space.
#
# In addition, comments can be inserted into lines (such as this line),
# they must follow the node name and are separated from it by a '#' character.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # origin server
# 38.25.63.10 x.acme.com # x client host

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

The key in this file are only the last two lines, everything else is nothing more than technical description informational in nature. These two entries are identical. The first entry is the original IPv4, and the second is the localhost in IPv6.

File hosts can be used to speed up the Internet and reduce the amount of traffic. This is achieved by reducing queries to the DNS server for resources frequently visited by the user. For example, if you use every day search engines Yandex and Google (sites http://yandex.ru And http://google.ru respectively), then it makes sense in the file hosts below line 127.0.0.1 localhost add the following lines:

93.158.134.11 yandex.ru

209.85.229.104 google.ru

This is what it will look like in the file hosts:

This will allow your Internet browser not to contact the DNS server, but to immediately establish a connection to sites yandex.ru And google.ru.

The Hosts file is sometimes used by a computer administrator to block unwanted web resources. To do this you need after the line 127.0.0.1 localhost add a line or several lines:

127.0.0.1 address of blocked resource-1

127.0.0.1 address of blocked resource-2

127.0.0.1 address of blocked resource-3

For example:

Impact of malware

As we already said, a request to a file hosts happens first, and then to DNS servers. It is known that the contents hosts file can be controlled by the computer administrator, and when certain conditions are created, unfortunately quite often, malware can also have an impact.

What are the attackers' goals?

  • Blocking access to well-known and popular sites;
  • Redirecting the user to other sites (advertising, phishing pages).

As a result, an attacker and fraudster can gain access to your data (logins and passwords), cause some damage by taking possession of your information, or worse, money.
If when checking hosts file on your computer is no different from the standard file, which means there are no problems.

But malware can add to the file hosts additional entries that are highly undesirable. Always pay attention to the entries after these lines:

#127.0.0.1 localhost
# ::1 localhost

Typically, malicious code is executed after a program downloaded from the Internet is launched. At this point, changes are automatically made to the properties of the browser shortcut and quite often additional lines are added to the file hosts.

To block a resource, approximately the following lines are entered:

127.0.0.1 Resource URL

This is the same as what we discussed in the Limitations... section, only it will be performed by a malicious program. And you will not be able to visit this web page because it is blocked on your computer.

To redirect to another site in a file hosts something like this is added:

157.15.215.69 Resource URL

In this case, after entering the URL of the required resource in the browser, the user will be redirected to a completely different site, the purpose of which can only be guessed at.

By restore I mean returning to the original or default state.
In fact, the entire standard hosts is the last two lines, everything else, as you already know, is a simple description.


It must be remembered that apart from these entries, nothing else should be present in the file. Everything unnecessary should be deleted immediately, of course, if you yourself did not add anything to the file hosts.
After making changes, save the file.
You can use a standard file hosts for Windows 7, 8 and replace the damaged one in the C:\Windows\System32\drivers\etc\ folder.

If the following steps fail:

  • There may be a permissions issue. You need to run a text editor with administrator rights and through the menu File → Open, find the hosts file and edit.
  • It is advisable to disable antivirus protection in real time. Many modern antiviruses prevent you from making changes to the file hosts.
  • Enable the display of extensions for registered file types, hidden files, and system files.

There are no more words. All! All the best and brightness to you! Bye. L.M.

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 in 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 line(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 no different from the previous one, but now we need to go to the folder in which the text editor executable file is stored, for example Windows Notepad(this part of the instructions will also apply to 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

In the Windows 8 operating system, the file hosts is located in the following path:
C:\Windows\System32\drivers\etc\hosts. This is normal text file, which stores the IP addresses of domain names on the local machine and is generated manually by the computer 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 with. In the window that appears, find and select Notebook.


Select Notepad

You can 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 it in the folder C:\Windows\System32\ file notepad.exe and right-click the context menu, where we select . And then through the File-Open menu we find the hosts file in the folder C:\Windows\System32\drivers\etc\.

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