Normal host file. Contents of the hosts file. Where is the hosts file located?

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

Hosts - text file, containing a database of domain names and used when translating them into network addresses nodes A request to this file takes precedence over calls to DNS servers. Unlike DNS, the contents of the file are controlled by the computer administrator. All of the above means that with the help of this file you can very easily and simply set up access to any of the existing Internet resources. Let's say you wanted to block access to one of the popular social networks, for example. To do this, you will have to write just a few lines in hosts and save the changes. After this, any user who uses your computer will simply not be able to get into VK, since access will be denied. Of course, with a set of minimal knowledge, this prohibition is easily circumvented.

An ordinary user should theoretically know nothing about the hosts file, since it simply has no use for him. Alas, modern realities are such that we have to learn a lot of new things. The fact is that in the last few years, a lot of fraudulent organizations have appeared that use hosts to steal personal information, as well as to take money from a person by redirecting him to other sites for the purpose of extortion. So that you understand what I'm talking about, I'll give you an example. Let's say you decide to go to the same VK. Only instead of your page you see a warning asking you to send an SMS to short number in order to make sure that you are a real person and not a robot. There may be other reasons, in this case it does not matter. You send a message, after which money begins to be debited from your account. This is the fraud of which you have become a participant. You must immediately call your telecom operator, explain the situation and ask for a refund to your account. Most likely, you will have to write a written statement, after which the funds will be returned to you, since they were withdrawn from the account illegally.

How could this happen? Using the hosts file, you are automatically redirected to a fraudulent site that only appearance resembles the usual VKontakte, while the address in the line can be real (that is, vk.com). However, this is not VK. To verify this, you can open hosts and see extra lines like 111.222.333.333 vk.com, with the help of which the redirection occurs.

Another question arises - how can the hosts change? Yes, it’s very simple: to do this, you just need to install a Trojan on your PC, which will perform the entire operation without your knowledge. And you can pick it up on almost any website.

So, now let's move on to the main question, namely: what does the file look like? Let me say right away that it varies slightly depending on the operating system.

Windows XP

# Copyright (c) 1993-1999 Microsoft Corp.
#

#




#space.
#


#
# For example:
#

127.0.0.1 localhost

Windows Vista


#
# 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

Windows 7 and 8

# 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

As you can see, the files are practically no different from each other, with some differences. However, I recommend using your own hosts for each operating system. Just copy the specified data.

By the way, the files are located in the following sections:

  • In Windows XP/2003/Vista/7/8 C:\WINDOWS\system32\drivers\etc\hosts
  • On Windows NT/2000: C:\WINNT\system32\drivers\etc\hosts

If you do not have the opportunity or desire to change this file yourself, you can use a utility called, which I recently talked about - it automatically changes contents of hosts, if it contains extra characters.

Hey guys! Do you know what the hosts file should look like? One of the important components of any operating system is the hosts file, and today I will tell you what the hosts file should look like and how to find it among other files. Why is this important to know? The fact is that when any virus attacks, it is the hosts file that is damaged first.


The system malfunctions when the virus itself adds it to the file. certain records that block access to antivirus updates, replace real sites with pirated ones, etc. Today I will teach you how to identify such unauthorized entries in this file. Simply open the hosts file using Notepad. If you see entries like this (or something similar)

  • 127.0.0.1 kaspersky.com
  • 127.0.0.1 kaspersky-labs.com
  • 127.0.0.1 liveupdate.symantec.com
  • 127.0.0.1 liveupdate.symantecliveupdate.com

Then we will have to disappoint you: the file is damaged by a virus.

We'll talk about file recovery below. Now pay attention to what the hosts file should look like in Windows XP.

Recovery damaged file download the text file and copy its contents to your hosts file. Here you can download a text file with contents hosts file(Windows XP). And this is what the hosts file looks like in operating systems Windows systems Vista, Windows 7 and Windows 8.

Here the recovery procedure is the same as in the previous case. From this link you can download a text file with the contents of the hosts file (Windows Vista, Windows 7 and Windows 8).

Now you know what the hosts file should look like. I offer several useful tips on working with him. To restore the hosts file, it is not necessary to save it in its original form. When you see the “#” symbol in a file, it means that all the characters coming after this symbol have no meaning. They can be deleted because they do not affect the operation of the system.

To find the hosts file, go to: WINDOWS\system32\drivers\etc\ folder. To access this folder, enter the following command in the “Run” window: %systemroot%\system32\drivers\etc. To open the hosts file, use the standard Notepad program. And finally: if you accidentally deleted this file, you can restore it by creating a regular text file and deleting the .txt extension.

Today you learned not only what the hosts file should look like, but also how to restore or find it. Leave your questions and feedback in the comments line. I was glad to help!

Few users who work with the "seven" and surf the Internet realize the true meaning of the HOSTS file (Windows 7). Its content will be shown a little later, but for now let’s dwell a little on the theory.

why is it needed?

In general, if anyone paid attention, the file itself is located in the etc directory, if you sequentially move along the tree from Windows folders, via System32 to the drivers directory on system disk. Not everyone, however, goes into such a thicket of the system; by and large, this is not necessary. On the other hand, if you pay attention, the object itself does not have an extension, although, in fact, it is an ordinary text document.

But let's take a closer look at Windows 7. Its content is that it is this object that is responsible in the system for the relationship between host names (sites, nodes, etc.) and determining their IP addresses to provide the end user with access to the resource. Roughly speaking, we do not need to enter combinations consisting of numbers in the browser, but we can only specify the names of resources.

And one more small clarification about the HOSTS file (Windows 7). Its content may change. Depending on what changes have been made, this can help block certain sites, speed up access to certain resources, or, on the contrary, can play a cruel joke by redirecting the user to dubious sites. However, first let's look at the original file.

(Windows 7): Contents

So, first, let's try to open It must be said that if you use the standard double-click method, nothing will work, because, as mentioned above, this object does not have an extension. In addition, the file may be hidden, so you should first select show hidden objects in the view menu. But the system will offer several applications to open. We choose the simplest thing - standard Notepad and look at the contents of the HOSTS file (Windows 7). Before us is something incomprehensible: descriptive text, some examples and a line indicating the local IP (# 127.0.0.1 localhost). That's how it should be.

Attention! There should be nothing below the line indicating the reserved local address, unless, of course, the user wants some resource to be blocked!

In general, everything above localhost is allowed resources. Everything below is blocked. It is not difficult to guess that many viruses, in particular programs that distribute spam or advertising (Malware, Adware, etc.) independently edit the contents of this file. So it turns out that when requesting one resource, the user receives a redirect (redirection) to a completely different one.

Default HOSTS in Windows 7

We reviewed the original file. Now let's look at the changed content. To correct it, you can take the contents of a “clean” file for the “seven” from another computer or from the Internet, copy it, then paste it into the original and save it.

But there is one problem. The fact is that sometimes, after removing everything unnecessary, it is not possible to save the file as the original (the system simply does not allow this to be done).

What to do in this case? First, delete the original completely (Shift + Del), bypassing the Trash. Then we right-click on the empty space inside the etc directory and create a new file with the same name, but do not specify the extension. Now we insert the necessary content into it and save the object. After this, you need to find the lmhosts.sam file there and delete it, as indicated earlier.

That's it, it's done. In both the first and second cases, a system reboot is required. Only then will everything work as expected. And, of course, editing should be done exclusively with administrator rights.

Bottom line

In general, there were very brief information about the HOST file. If you look at the issues of blocking some unwanted resources or, on the contrary, allowing access to them with faster access, editing must be done exclusively manually and according to certain rules. Here you need to remember that the key role of the separator is played by the line indicating the reserved local IP. Well, then, as they say, it’s a matter of technique. By the way, the above technique will also help if the contents of the object have been changed due to the influence of virus programs.

Which we publish on the website. This file is an important element of the operating system, so it is not surprising that users so often ask questions related to the hosts file. One of typical questions, is the question of what the hosts file should look like.

The fact is that many viruses, when they enter a computer, damage the hosts file. They add their own entries to it, the purpose of which is to block access to anti-virus updates or replace real sites with fraudulent ones. It is very easy to detect the appearance of such alien records. Just open the file using Notepad.

If the hosts file contains a lot of lines like this:

  • 127.0.0.1 kaspersky.com
  • 127.0.0.1 kaspersky-labs.com
  • 127.0.0.1 liveupdate.symantec.com
  • 127.0.0.1 liveupdate.symantecliveupdate.com

This is the work of viruses. After removing such viruses, the hosts file remains damaged and users wonder how to restore it.

What the hosts file should look like in Windows XP

In the picture you can see what the hosts file should look like in the Windows XP operating system. If you want to restore the hosts file in this form, then you need to download the text file and its contents to your hosts file.

What the hosts file should look like in Windows Vista, Windows 7 and Windows 8

In the picture you can see what the hosts file should look like in the Windows Vista, Windows 7 and Windows 8 operating systems. If you want to restore the hosts file in this form, then you need to download the text file and copy its contents to your hosts file.

How to restore the hosts file. It is not necessary to restore the hosts file to its original form. The "#" symbol in the hosts file means that any text after this symbol is a comment and should be ignored operating system. Thus, all lines of the hosts file that begin with the “#” character do not affect the operation of the system in any way and can be harmlessly deleted.

How to open the hosts file. The hosts file has no extension, but is nevertheless a regular text file. Therefore it needs to be opened standard program Notebook.

What to do if the hosts file is deleted. If the file is deleted, you can restore it by creating a regular text file and .

What's happened hosts file? This question is usually asked by newbie users who know about the existence of such a file only by hearsay. Few people know that this file is used for their own purposes by virus writers, and even fewer are those who use this file on their computer for their own benefit. Meanwhile, it is very important that you have at least some idea about the file hosts and even more important that any user knows how to handle it correctly.

Problems such as: " I can't log into VKontakte." or " Doesn't fit into classmates?"and similar ones in half the cases (if not more) are associated precisely with changes made in the file hosts. Another question is who makes such changes. In most cases, of course it is viruses, which replace the original hosts file on your computer or add their information to it. All this will be discussed in this article.
First, I’ll tell you about the file itself. hosts and what it serves for.

Hosts. What it is?

In fact hosts is a text file that contains the database domain names compared with their IP addresses. In other words, the address of any domain initially has the form of an IP address. One IP address can have several virtual servers, so there can be several sites on one IP. IN hosts The default file contains only one ip address (127.0.0.1), which is reserved for localhost, i.e. for your local (namely your) computer.
Myself hosts file on your computer is located at the following address: (table source: Wikipedia)

operating system Versions Location
Unix and Unix-like /etc/hosts
Windows 95, 98, Me %windir%\
NT, 2000, XP, 2003, Vista, 7 %SystemRoot%\system32\drivers\etc\ , its location can be overridden in the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\DataBasePath , which contains the folder path.
Windows Mobile Registry key \HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts
MacOS 9 and earlier System folder: Preferences or just in the system folder
Mac OS X and iPhone OS /private/etc/hosts or /etc/hosts (/etc on Mac OS X is a symbolic link to /private/etc)
Novell NetWar SYS:etc\hosts
OS/2 and eComStation "bootdrive":\mptn\etc\
Symbian OS 6.1-8.1 C:\system\data\hosts
9.1+ Z:\private\10000882\hosts
Android /system/etc/hosts

Hosts file has no extension, but is easy to edit text editors (for example Notepad)

Hosts. History of origin.

When computers were very large, and the Internet was still very small, even then, for the convenience of users, hosts were assigned names. There were few hosts back then. To map text names to IP addresses, it was necessary to send a request to the main host, which sent a list of all names and addresses. This file ( host file) was regularly sent to all computers connected to the Network. As it develops and expands Global Network the number of hosts, servers, users increased, and the host file. There were significant delays in registering and obtaining a name for a new computer connected to the Network. Too much time was spent on mailing host file... To solve these problems, it was created DNS– Domain Name Service. ABOUT hosts file forgot for a while...

Hosts. Principle of operation.

Request to hosts file has priority over access to DNS-servers. Unlike DNS, the contents of the file are completely controlled by the computer administrator. What happens when an Internet user types a website address (url) into the address bar of his browser and clicks go ( Enter) ?
The browser contacts DNS a server that converts this regular address into the IP address of the requested server. At this moment the browser status bar says: “ Search for a node..." If the requested node is found, the text “ Node found, response awaited...", and is installed TCP connection via the standard port for this service. Step by step, more clearly to the question “ What happens when an Internet user types the site address (url) in the address bar of his browser and presses go (Enter)?"You can answer that:

  1. browser accesses hosts file and checks whether the site name matches the computer’s own name ( localhost) i.e. Is the site's IP address equal to the local IP address? 127.0.0.1 ;
  2. if not equal, then checks hosts file for the presence of the requested address (host name);
  3. if the requested address (hostname) is in hosts file, then the browser goes to the host (ip address) specified in this file;
  4. if the requested address is in hosts file not found, the browser accesses the DNS resolver cache ( DNS cache) ;
  5. if the requested address (hostname) is found in DNS Cache e, then accordingly the browser accesses DNS server y;
  6. if such a web page (site) exists, then DNS server translates url V ip address and the browser loads the requested site page.

So we found out why and How does it work hosts file . Now let's see what it contains.

Original hosts files. Default contents of hosts files.

Below I will provide the text that should be contained in hosts file by default, i.e. original hosts file.

Windows XP

# Copyright (c) 1993-1999 Microsoft Corp.


#102.54.94.97 rhino.acme.com

# source server

# 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

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

# Additionally, comments (such as these) may be inserted on individual

# lines or following the machine name denoted by a ‘#’ symbol.

127.0.0.1 localhost

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

# Additionally, comments (such as these) may be inserted on individual

# lines or following the machine name denoted by a ‘#’ symbol.

# 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

Using the hosts file for your own purposes.

Hosts file can be used to reduce the number of requests to DNS server am for frequently visited resources, and this in turn will reduce traffic and speed up the loading of frequently visited resources. For example: you often load the sites google.ru and google.com. Opening hosts file using Notepad and after the line 127.0.0.1 localhost add:
209.85.229.104 google.ru
74.125.232.20 google.com

Before adding, please read the rules below. editing hosts file

This action allows the browser to immediately, without contacting the DNS server, establish a connection to the sites google.ru and google.com.
Besides hosts file can be used to block access to unwanted resources on the Internet (adult sites, spam sites, sites with malicious software etc.). This can be done just as easily by adding immediately after 127.0.0.1 localhost next line
127.0.0.1 url of the blocked_resource.
This way the resource address is mapped to the IP address of this computer, and therefore the resource will not load.
After all changes, when exiting the notepad, save the result.

Rules for editing the hosts file

  • Each element must be located on a separate line, i.e. when adding a new address, be sure to move to a new line (press Enter);
  • The IP address must start from the first position of the line (let's say so at the beginning of the sentence), must be followed (on the same line) by the corresponding resource address (hostname);
  • The IP address and resource name must be separated by at least one space;
  • Comments must be separated by # (lattice) ;
  • If comments are used in domain name matching strings, they must follow the host name and be separated by # (lattice) ;

We've sorted out the editing rules. Now let's look at how virus writers and viruses use the hosts file for their own purposes.

Use of the hosts file by virus writers.

Those who write viruses have long appreciated the possibilities hosts file and actively use them to their advantage. Viruses replace your hosts file or edit it so that when you type specific address(usually the addresses of popular sites) the site that opened was not the one you had in mind, but the one that looked similar to it, but in fact is a site of attackers and distributes malicious codes. In addition to redirecting to their sites, they also block access to the site while extorting money from you in order to re-open access. Attackers mainly use blocking to in social networks.
On the Internet in many forums you can find thousands of user questions like: “ I can't log into Contact. What to do?" or " Why can't I log in to Odnoklassniki?" or " I can't log into Facebook. Profile is blocked. What to do?". All these problems begin as a result of the fact that you caught a computer disease somewhere. virus and he edited your file hosts. I already wrote about this in the article and will not repeat it, (fortunately, it describes how to fix all this, and therefore I advise you to read this article to the end as well), but I’ll describe the situation when this file hosts I can’t find the address on my computer at all. I will explain clearly with an example windows 7. Let's say you go to a folder and see this picture:


As you can see from the picture, in this folder hosts file absent ( file lmhosts no need to touch). In fact, it is there, the virus just changed the file attribute to “ Hidden" or " System". I wrote about the “Hidden” and “System” attributes.
By default, in the folder options there is a checkbox next to the setting “ Do not show hidden files, folders and drives". We need to change this parameter to " Show hidden files, folders and drives". To do this, click Start—> next Control Panel—> next Folders settings View". Here at the very end we rearrange the button with “ Do not show hidden files, folders and drives" on " Show hidden files, folders and drives«.


Now going to the folder C:\WINDOWS\system32\drivers\etc we see that hosts file on the spot.
Sometimes hosts file cannot be edited due to viruses on the computer. In such cases, you can simply delete the hosts file and then create it again yourself. To create hosts file, in folder C:\WINDOWS\system32\drivers\etc create a simple one Text Document and call him hosts(I hope everyone knows how to do this). The result will be a text document with the extension .txt(hosts.txt). And as we already know the hosts file has no extension. This means we remove the extension from the name. We do not see the file extension in the name because in the default system configuration the extension for registered files is hidden. Well, let's break it down.
To do this, click again Start—> next Control Panel—> next Folders settings(in XP “Folder Options”). In the window that opens, go to the second tab “ View". Here (just above the line “Do not show hidden files, folders and drives”) uncheck the " Hide extensions for registered file types". Having done this we will see the file name hosts along with the extension .txt. Now we change the name and remove the unnecessary, namely .txt.
IN windows 7 x64 to find the hosts file you may have to go to the line “ Start - execute» (details about commands) type the command:
cd\windows\system32\drivers\etc\ and then launch notepad with administrator rights to open hosts.
Those who cannot or do not want to create a hosts file themselves can download it from our website. Here are the links:
Original file hosts For
Original file hosts For
Original file hosts For

Afterword:
Phew... It turned out to be a voluminous article. I think it will be useful to you, both in terms of theory, knowledge base, and in practice.
That's all. I look forward to your comments.



tell friends