What is hosts file location on windows 10 and how to edit hosts file?

What is hosts file location on windows 10 and how to edit hosts file?

This artical is about the "What is hosts file location on windows 10 and how to edit hosts file?
". A complete guide about Hosts file and its purposes.

What is Hosts file?

A hosts file is a local file on a computer which contain all the hosts and their IP address. Basically hosts file map the domain name or hosts names into IP addresses.
When the Internet (WWW) did not exist as such, but there were already small local networks from computers connected to each other, even then they came to the conclusion that it is much easier to access hosts (computers on the network) by name, rather than by a digital code called an IP address. Therefore, a list of correspondence of the hosts name and its IP address was manually generated. Such list was called Hosts and sent to all nodes on the local network. Everything was wonderful right up to the moment when it was no longer possible to use such a method due to the huge number of records contained in this file. Sending it has become problematic.


Purpose and Uses of Hosts File

Hosts file is available on all operating system from linux to windows. Another distinctive feature of it is that it does not have an extension, but this is due to the fact that it works it must be in any OS, and therefore must be universal. Although it is a relic of the past, there are still plenty of ways to use the Hosts both for good and not very good purposes. For example, viruses and virus writers love it very much and often use either phishing duplicates of official sites or to block the ability to update your antivirus program.
In past when we don’t have a fast internet connection, many users registered the resources they visited most often in Hosts files. And also blocked the servers through it with advertising, well, or access to the programs that they activated, let’s say, without paying developers.
But even now, this file can be beneficial, including for webmasters. For example, when changing the hostsing, you sometimes have to wait a day, before the new IP address of your site is registered through all DNS servers. However, you can begin to work and test the site on a new hostsing immediately after its placement there in hosts file.
In addition to this, it will generally be useful to know where the Hosts file is located, how to find it on different operating systems, how to check it for virgin purity from virus entries, and, finally, how it should look in the original.
Syntax of hosts file:
By default there is only single entry in hosts file:

#127.0.0.1 localhosts
#::1 localhosts

IP address 127.0.0.1 is address of local hosts (pointing to same computer). Second line is representing the ipv6 address of same localhosts. Both standards for setting IP addresses are still used or can be used, and both lines are usually present in the Hosts file. Following is the simple of hosts file present on windows.


The syntax of the hosts file is very simple. Every entry is starting with ‘#’ symbol followed by the the IP address, and then the name of the hosts (computer, hosts or domain) is written. A separate line is used for each record of this kind.
Locations of the hosts file on windows 10
This raises the main question, and what is the current position of Hosts in the process of establishing the correspondence between the domain names entered in the browser and those IP addresses that are hidden behind these domains? Well, as it turned out, it occupies a very important place, namely the first.

In older versions of Windows, such as XP or 2000, it was open to all comers and lived in system folders at the following address:
Windows\System32\drivers\etc\
You won’t believe it, but he lives at the same address both in Windows 7 and windows 10, but everything is somewhat more complicated there, for having passed along the path:
c:\Windows\System32\drivers\

Folders etc you will not find there. The developers decided that ordinary mortals should not touch this file to avoid problems.


However, the hosts file in windows 7 and vista still has a place to be, you just need to look for it, having received Administrator rights. Personally, I never even tried to figure out all this nonsense with rights, but for myself I found a very simple way to get around this restriction.

How to edit a hosts file?

Open the hosts file directory from his path and then right click on hosts file and open it with the notepad.




Well, actually, half the job is done. Now in notebook, select “File” - “Open” from the top menu. In the standard window of Windows Explorer, find the desired folder etc (inside the Windows \ System32 \ drivers \ directory), select in the bottom right corner from the "All files" drop-down list and with happy eyes observe the appearance of this top-secret file:

How to remove virus entries from hosts file?

Hosts file will be without expansion, and the rest of the crap, like hosts.txt, is very often created by viruses to distract your attention and confuse you in the end. For the real file, they set the “Hidden” attribute, which can be set or removed by simply right-clicking on the file and choosing the lowest “Properties” item:
We still found where this secret (for Windows 7 and vista) file is located, and we should carefully examine it for possible abuse. If the initial examination of the patient did not reveal any pathologies, then look at the scroll area of ​​the page in Notepad .

Sometimes the virus makes its entries after several hundred blank lines, thereby reducing the risk of them being detected by you. If there is no scroll bar, then everything is fine, but if there is, then use it and bring your Hosts to the form that it should have from birth, i.e. it will be sufficient to have only two lines in it

127.0.0.1 localhosts
 ::1  localhosts

Well, if the substitution of addresses in this file is pretty simple, for example, it might look like this:
127.0.0.1 localhosts
 ::1  localhosts
77.88.21.3 w7cloud.com
So how, then, is blocking certain sites through hosts? Well, just the domain you want to block is assigned a private IP address of 127.0.0.1, for example, like this:
127.0.0.1 localhosts
 ::1  localhosts
127.0.0.1 vk.com
127.0.0.1 w7cloud.com
The clever browser finds this correspondence and tries to get the necessary document (web page) from your own computer, which, naturally, does not succeed and about which he will immediately inform you. By the way, this is a good way to block your children access to sites that you think they should not visit. Of course, it will still be necessary to create a list of such sites or take them somewhere, but if you wish, you can completely try.
As I mentioned, in ancient times, when the Internet was still slow for most users, they were prescribed IPs in Hosts to speed up the opening of sites. Another thing is that these same resources periodically changed the hostsing and with it the IP addresses. And the user, having forgotten about what he did six months ago to speed up the Internet, is trying in vain to understand why his favorite resources are not available to him.

How to use hosts when transferring a site to a new hostsing?

Well, in the end, I would like to talk about how, by making changes to the file, the Hosts can work with a site that has moved to a new hostsing before a new record is written on all DNS servers (matching your domain with a new IP address ) The method is very simple, but effective.

So, you are changing the hosts. Naturally, the IP address of your site is changing. How do they find out on the Internet? Everything is correct, using the network of DNS servers. By the way, you will take the first and most important step yourself by going to the control panel of your registrar and writing down the addresses of the NS servers of your new hostser there.

It is from them that the new DNS will spread throughout the Internet. But this process is lengthy and in the worst case scenario it can take a couple of days. At this time, the site should be available on both the new and the old hosting, so that users from all over the world would not be deprived of the opportunity to see it.

However, you yourself will be interested to find out, but how, in fact, your resource feels at the new hostser? Check the operation of all plugins and other things. Do you really have to wait from a few hours to two days? After all, it is unbearable.

Firstly, it will be possible to try to reset the DNS cache on your computer itself, because it may prevent you from seeing your resource on a new hostsing if external DNS servers have already received a new record. How to do it? Again, everything is very simple. Press the key combination Win + R on the keyboard (or select the "Run" item from the "Start" menu), and then enter in the window that opens:
A very scary window will open under the name of the command line, where you will need to insert this command:

ipconfig /flushdns
Regular paste buttons in the command window do not work, so just right-click on it and select "Paste."



After that, click on "Enter", the DNS cache will be cleared on your computer and you can try to open your site again. By the way, DNS cache may also be present in the browser itself, so clear it or refresh the window by holding down the Shift button on the keyboard.

By the way, if interested, you can view the contents of the DNS cache by entering the following command at the command prompt:

ipconfig /displaydns
Still opening a site on an old hosting? No problem. We find the Hosts file described in the way described above and adds only one line to it:

109.120.169.66 w7cloud.com

Where 109.120.169.66 - this will be the IP address of your new hosting , and then the domain name of your site will follow. Everything. While the rest of the world admires your resource on the old hosting, you have the opportunity to fix possible jambs on the engine already transferred to the new hosting. The thing is wonderful and I always use it.

No comments:

Post a Comment

UA-23728446-1