Hosts file 127.0 0.1 localhost. Original hosts for Windows operating systems. Restoring the default hosts file

💖 Do you like it? Share the link with your friends

Altered Windows hosts files may prevent game client installation, or cause issues with patching. The hosts file is a Windows system file that can override DNS and redirect URLs or IP addresses to different locations. A typical home internet user will not have a modified hosts file.

Checking for Modifications

  1. Press Windows Key + R.
  2. Type OK.
  3. Open the hosts file with a text editor such as Notepad. Hosts will not have a file extension.
  4. Compare your hosts file with the Microsoft defaults listed below. If yours is different, it has been modified. Remove any lines that contain Blizzard URLs or addresses.
  5. Save the file.

Note: If your hosts file was modified, run a virus scan . Viruses and malware can modify the hosts file to try to redirect your computer to malicious websites.

Common Problematic Modifications

These modifications negatively affect Blizzard games. If you find them, remove them:

  • 127.0.0.1 eu.actual.battle.net
  • 127.0.0.1 us.actual.battle.net
  • 127.0.0.1 enGB.nydus.battle.net

Resetting the Hosts File to Microsoft Defaults

To reset the Hosts file back to the default, follow these steps:

  1. Press Windows Key + R.
  2. Type notepad into the Run window.
  3. Click OK.
  4. Copy the following text to the Notepad window: # 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 # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
  5. On the File menu, select Save as, type "hosts" (including the quotation marks) in the File name box, and then save the file to the desktop.
  6. Press Windows Key + R again.
  7. Type %WinDir%\System32\Drivers\Etc into the Run window and click OK.
  8. Rename the Hosts file to "Hosts.old".
  9. Copy or move the Hosts file that you created from your desktop to the %WinDir%\System32\Drivers\Etc folder. If you are prompted to enter an administrator password, select Continue.

What is the Hosts file for?
The purpose of this system file is to assign certain addresses sites of 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 OS Windows location 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 windows, but not really. It is "written" in English language why it is needed and how to make exceptions with 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?
Hosts file You can use 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 having entered 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 access the site, you see it 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 standard means You cannot access the site.

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 can’t save the file, you need to log in account Administrator.
  • 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.

  • Hi all! Yesterday I spent the whole evening on Skype, helping a friend solve the problem of why VKontakte would not open for him. The answer was practically on the surface, but as usually happens in such cases, we stubbornly did not notice it. The whole trick was that a friend, working on his website in Denver, opened Contact (with Denver running, respectively), and then turned off the computer without turning off Denver. And as a result, in the VKontakte hosts file I entered it with a local IP. Therefore, today, taking a moment, I decided to write another post, devoting it to the hosts file. In this article we will talk about what the hosts file does, what it is for, how to find it, how to edit and save it. Also, at the very bottom of the article, you can download the hosts file. I will try to describe everything in simple human language, so that even an amateur who is not particularly versed in computers can understand.

    What's happenedhosts? The hosts file is a text file on your device with Internet access (computer, smartphone, etc.). The hosts file contains a database of domain names. Every time you write this or that website address in your browser, a request is initially made to the hosts file, and then only a request is made to the DNS (external servers located on the Internet). And if you block this or that address in the hosts file, then it will no longer be possible to access it from this computer. That's probably all the hosts file does.

    How to find a filehosts? Hosts file in different operating systems ah lies in different places. Below is a table of how it can be found in the most popular OS

    Everything below, until the next paragraph, is dedicated to those who do not know what to do with this table. And so, if for you this is Filka’s letter written in Chinese, then most likely you have Windows. Here, based on this OS, I will explain how to find the hosts file.

    Go to My Computer. Click on the address bar (see screenshot) and paste this phrase there: C:\Windows\system32\drivers\etc. This is the path to the hosts file. Then press Enter.

    We find ourselves in system folder. Find the hosts file. All! You can congratulate yourself, you are a Computer Genius! 😉

    If you have any problems, or you have a different axis, and you don’t know what or how to do, then write in the comments, I will be happy to answer. And we move on.

    How to open a filehosts? Since we have found the hosts file, now we need to open it somehow. There is nothing complicated about this. Opens hosts with any text editor. I use Notepad++, but you can open it with any other one. Even with regular Notepad, built into Windows by default.

    What should be in the hosts file? Nothing extra. But seriously, a clean hosts file should look like this:

    # 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

    If you write in English, then, as you can see, the file itself describes in detail what the hosts file does, what should be in it and how to change it. I also want to remind you that at the end of the article you can download the hosts file, so there is no need to copy it from here.

    But it is unlikely that you will see exactly such a file. Most likely, there will be other lines in your hosts file. For example, if you use Adobe products, then at the end you will find something like:

    127.0.0.1 adobe-dns.adobe.com 127.0.0.1 adobe-dns-2.adobe.com 127.0.0.1 adobe-dns-3.adobe.com

    Now let's get to the fun part:

    Editinghosts. And so, now we will learn how to change the hosts file. First, let's understand what certain symbols mean in it. It’s very easy, at the first grade level (my student goes to the second grade and edits this file once or twice).

    Everything marked with a “#” is a comment. We don't take them into account. Those. you can put "#" and write whatever you want. This will not be taken into account by the computer in any way. But, as soon as you move to a new line, if you don’t put “#” again, the computer will start taking your line into account. Let's say it again, the line with “#” is a comment and is not taken into account by the computer.

    In the desert, lines in hosts are ignored. You need to put them only for your convenience, so as not to get confused later.

    The numbers 127.0.0.1 are the local IP address. What are IP addresses, this is a whole article to write. Therefore, now the main thing for us to remember is that any Internet address after 127.0.0.1 will be ignored, and you will not be able to access it on the Internet.

    For example, having a line like:

    127.0.0.1 google.ru

    You will not be able to enter Google search engine. Thus, you can deny access to any site by simply entering the url of the unwanted site after the local IP address.

    These lines must be entered at the end of the file. Each new site address must start on a new line.

    Sometimes it happens that some programs change this file, mainly Virtual Servers or viruses. But if virtual servers after they are closed, return hosts to the initial state, then viruses maliciously edit hosts. In any case, the result is the same: you cannot get to this or that site. Therefore, if you cannot access any site, check the hosts file, perhaps access is denied in it.

    Now I will reveal one terrible secret. Social networks and some other sites are often blocked at work. Often, ISPs block users using the method described above. But you already know how to change the hosts file 😉

    By the way, if you want to prevent your child from accessing certain sites, then you can easily edit the hosts file, indicating the addresses of unwanted resources in it. As a result, your hosts file will look like this:

    # 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 127.0.0.1 Enter the address of the site you want to block 127.0.0.1 Enter the address of the site you want to block 127.0.0.1 Enter the address of the site you want to block

    That's it, after we have edited the hosts file, we can safely save it.

    Problems with the Internet connection are one of the most common consequences of a computer being infected with a virus. In this case, the sites either do not open, or instead of one site the user ends up on another, and this behavior can be observed even after the virus is removed. Cause? Change malware system settings and files, among which one of the most important is the hosts file.

    Why is the hosts file needed and where is it located?

    You've probably already heard something about this file; it seems to be used to block sites or something like that. Yes, it does contain such functionality, but it was originally used for other, more important purposes. By the way, did you know that the hosts file is present not only in Windows 7/10, but also in Linux, Mac OS and Android? This versatility is not at all accidental, because the hosts file appeared at the dawn of the Internet.

    Actually, there was no Internet in the full sense of the word then, and if there was anything, it was small local networks. As now, computers in them communicated through IP addresses, which were understandable to machines, but not very convenient for users. Then the IT people decided to implement access to computers by name, which they did, but IP addresses did not go away; hosts still needed digital, not analog addresses for messages.

    A solution was found very quickly. For every computer in local network a special Hosts file was sent out with a list of host names and their corresponding IP addresses. When one computer addressed another by name, the latter was matched with its digital address, and thus a connection was established. At first everything was wonderful, but there were more and more resources, the list in the Hosts file grew, and sending it to a PC became more and more problematic. A new solution was needed, and one was also found. The correspondence table was transferred to the then already formed Internet, forming a domain name system, and the Hosts file became largely unnecessary.

    However, the developers did not remove it from their operating systems. It is still present in most operating systems, still establishing a correspondence between the IP address and the domain of the site and, as before, a request to it has higher priority over access to DNS servers, but its contents have now become much poorer, limited to two entries, and even then inactive. Currently, hosts are used mainly for banner exchange networks, automatic redirection from one resource to another, as well as speeding up access to sites.

    IN earlier versions Windows file the host was located in the %windir% folder, starting from NT its permanent location is listed as C:/Windows/System32/drivers/etc. In rare cases, the HOSTS file is located in a different folder; the path to it can be determined in the registry editor by expanding the branch HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/services/Tcpip/Parameters and looking at the value of the DataBasePath parameter.

    How to change the hosts file: opening, editing and saving

    So, we know where hosts is, now let’s see what can be done with it, and why it might need to be changed at all. In fact, the host file is ordinary Text Document, just without extension. You can open it with any text editor, the same standard Notepad.

    There are also special utilities like HostsEditor, but their use in most cases is perhaps unnecessary. The contents of the hosts file are presented brief information about its purpose and two examples of use. The syntax of entries is very simple. The IP address comes first, followed by the hostname a few spaces later. For example, IP 38.25.63.10 will correspond to the address x.acme.com, and IP 127.0.0.1 or::1 (for IPv6) will correspond to the address of the local computer (localhost).

    Please note that all lines are preceded by a # sign, this means that the line is commented out, that is, it is inactive, which is the same as if the file were empty. It will start working only when you add new entry. Let's give an example of how to change the hosts file in Windows 7/10 and use it to block a website, redirecting the request to the local computer. Let's say we want to restrict access to social network In contact with. To do this, add the following line at the end of the file:

    127.0.0.1 vk.com

    We save the HOSTS file like any other text file, restart the browser and try to access the site. As a result, you will receive the error “Cannot access the site.” It works very simply. When a user goes to vk.com, the browser first accesses HOSTS and looks for a match between the host name and its IP address, and, having found it, goes to the specified IP address, ignoring DNS server services, since accessing the host file is a priority.

    Of course, there is no social network on the local computer, so the browser returns an error. This way you can block any resources by registering them in HOSTS in a column. Another example of using a host file is redirecting to another site on the Internet. Everything is the same here, only instead of the local IP address 127.0.0.1 the address of another site is written. By the way, viruses often do this by changing HOSTS and adding redirects to phishing resources.

    This is why it is so important to know what the default hosts file should look like. If you haven't edited it and there are uncommented entries in it, this should be a cause for concern. However, anti-spyware utilities can also change hosts by writing into it the addresses of blocked unreliable resources. Changes can also be made by keygens used to bypass activation of licensed software.

    How to recover a deleted or modified hosts file

    Above, we looked at the basic principles of how the file works, and at the same time learned how to edit it. Alas, not everything goes so smoothly. Often there are complaints from users that the host file cannot be opened, and if it is possible, it cannot be edited or the system automatically deletes added lines from it. The main reason for this is that the user does not have the appropriate rights.

    Editing must be done with elevated privileges. How to open the hosts file as administrator if in context menu there is no corresponding option? Very simple. Go to the location of the Notepad or other executable file text editor, right-click on it, select “Run as administrator” from the menu.

    In the editor interface via the menu File – Open find and open the hosts file, only remembering to select “All files” instead of “Text documents” in the standard overview window.

    In Windows 8.1 and 10, a modified host file can be cleaned by system security tools, in particular, the built-in Windows Defender. To prevent this from happening, hosts must be added to the exclusion list. Launch Defender, go to the Settings tab and select Excluded files and locations on the left.

    Specify the path to the hosts file and save the settings.

    The system will no longer check it, therefore, the changes you made will not be canceled.

    In Windows 10, exceptions are made from the Windows Defender Security Center component, launched from the system tray.

    We also cannot rule out problems when trying to save an edited file. The reason is the same - lack of rights. Solving this problem is not difficult. Since the system does not allow you to save the edited file directly to the etc folder, save it to your desktop (remove the extension, if assigned).

    Rename the original file to hosts.old, and then copy the new modified hosts file from your desktop to the etc folder.

    There is a more radical way, for example, hosts can be edited directly by booting from any LiveCD with a built-in file manager.

    And one last thing. What to do if the hosts file has been changed or deleted? Is it possible to somehow restore it? Deleting this file will not affect the operation of the system in any way, unless you changed it for some specific purpose. As for recovery, there are several solutions. The source hosts file, although it contains data, is essentially equivalent to an empty file. Create an empty text file on your desktop, remove its extension and move it to the etc folder, this will be your new hosts.

    You can also take the file from another computer or virtual machine with Windows, there is practically no difference in OS versions. If you want to restore the contents of the original hosts, you can manually delete all uncommented lines or use the free healing utility Dr.Web CureIt! – it is capable of restoring the host by resetting its contents to the default state.

    This article will talk about the “long-suffering” system file hosts, which often suffers from network “malware” leaked onto the computer. Hosts has no extension, but essentially it is a regular text file and the built-in Notepad is enough to edit it. The purpose of the file is to store a list of domains and their corresponding IP-addresses. This is the list that the browser first accesses after entering, say, a domain name in the address bar Yandex.ru to find out that it corresponds to the address 77.88.21.11.

    Now imagine that an attacker program has changed the hosts"IP" Yandex.ru to the address of the “weed” site she needs. Now every time after typing in the browser Yandex.ru you will find yourself on some XXX.com. Of course, this disgrace must be quickly stopped, for which you will have to go directly to the file hosts. In the article I will outline a guaranteed way to do this, because... V latest versions Windows the developer has strengthened the security of the OS, which in practice has made life more difficult for users: the desired folder may not be visible or the file itself cannot be edited.

    So, to bring hosts should be opened into a “divine” view Notepad as administrator. To do this, go to the menu "Start"→ next," All programs" → "Standard" → right-click on Notebook and in the context menu select "Run as administrator ".

    In the appeared top panel click " File " → "Open" → in the address bar indicate the path to the desired folder – C:\Windows\System32\drivers\etc . If the folder is empty, in the “File name” line write hosts and click " Open" (next screenshot).

    The contents of the file can be compared with the original in Windows 7 and, in case of discrepancies, copy for yourself.

    # 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 # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost

    In principle, you can leave only one entry - 127.0.0.1 localhost or even leave nothing - in any case, this is better than the disgrace as in the screenshot below (a real example of the editors hosts villain-virus).

    As you can see, the malware blocked the update antivirus programs and access to social networking sites. To prevent the situation from happening again, it is recommended to protect the file with the " Only reading" by clicking on hosts right click → " Properties" → on the first tab "General" check the box next to the corresponding attribute.

    About what else useful you can do with a system file hosts I'll tell you in ours.



    tell friends