What windows host file is

How to Edit Your Hosts File in Windows 10

What is a Hosts File?

The hosts file is a local plain text file that maps servers or hostnames to IP addresses. This file has been in use since the time of ARPANET. It was the original method to resolve hostnames to a specific IP address. The hosts file is usually the first process in the domain name resolution procedure. Here is an example of a hosts file entry.

We use the above code as an example since it almost always included in every hosts file. Another example would be similar to the following entry.

  • The first section denotes the IP address where a request will be redirected to.
  • The second section designates the location that we want to redirect a request from.
  • The third section specifies a comment for the entry.
  • Each entry is usually separated by a space or a tab.

We would add the above entry to our hosts file to associate the hostname (or domain name)В liquidweb.comВ with the IP addressВ 67.225.187.61. To provide a working example, let’s move on to the next section.

Why is a Hosts File Useful?

Let’s say we have just completed a migration to a new server. In order to see how our domains will look and operate on our new server before we move our DNS settings, we cannot just type in one of our current domain names as it will resolve to the old server we are moving away from (since we never move our DNS A records from the old server until we are sure the new site is working as expected).

So, to see how our domain will look on the new server, (without having to change our DNS records) we can simply modify our local hosts file to point the domain to the new servers IP. If our domain is liquidweb.com and the old IP is 67.225.187.61 and our new IP will be 72.30.35.10, we can temporarily comment out the current liquidweb.com entry (using a ‘#‘ symbol) and add an alternate entry which points to the new servers IP.

If we added the above entry to our hosts file, every time we open liquidweb.com in our browser, we will now be redirected to the 72.30.35.10 IP.

Where is the Hosts File Located?

The location of the hosts file will differ by operating system. The typical locations are noted below.

  • Windows 10 — «C:\Windows\System32\drivers\etc\hosts»
  • LinuxВ -В «/etc/hosts»
  • Mac OSВ X -В «/private/etc/hosts»

What Does a Hosts File Contain?

A hosts file contains entries similar to the following information. Your entries may differ significantly.

How Do I Edit my Hosts File?

Our \etc\hosts file is only editable as a Windows administrator. В Here is a short video on how to edit a hosts file.

Here are the directions on how to modify your hosts file.

Step 1.
Click the Windows button and type Notepad in the search bar.

Читайте также:  Почему дисковод не видит диски windows 10

Step 2.
Right click on Notepad and then Run as Administrator.

Step 3.
You’ll be asked, “Do you want to allow this app to make changes to your device?”. Choose Yes.

Step 4.
In Notepad, choose File then Open.

Step 5.
Navigate to C:\Windows\System32\drivers\etc\hosts or click the address bar at the top and paste in the path and choose Enter.  If you don’t readily see the host file in the /etc directory then select All files from the File name: drop-down list, then click on the hosts file.

Step 6.
Add the appropriate IP and hostname at the end of your hosts’ file, select Save, and then close the file.

Step 7.
Finally, you will want to flush your DNS cache for your computer to recognize changes to the file. Click the Windows button and search command prompt.

Step 8.
Type the following command in the terminal and press Enter

Conclusion

Modifying a hosts file has many benefits which can significantly impact how you view your new domain or website. Using this method to view a site allows us to see how any new changes affect the layout and functionality of a domain.

Should you have any issues when modifying this file, our Support Teams are filled with experienced Linux technicians and talented system administrators who have an intimate knowledge of how to facilitate this modification. We are always available to answer any inquiries with issues related to this article, 24 hours a day, 7 days a week 365 days a year.

If you are a Fully Managed VPS server, Cloud Dedicated, VMWare Private Cloud, Private Parent server, Managed Cloud Servers, or a Dedicated server owner and you are uncomfortable with performing any of the steps outlined above, we can be reached via phone at 800.580.4985, or via a chat or support ticket to assist you with this process.

How to Edit the Hosts File in Windows

Can be useful for anyone in IT

The hosts file is a text-based file located in the same place in all modern Windows versions. Most people don’t ever need to get into it, but if you do, you’ll need to know how to open and edit the hosts file.

However, in some versions of Windows, editing the hosts file directly isn’t allowed. In fact, you’ll get an error if you try to save the changes. Fortunately, there’s a simple tip you can use to edit the hosts file in Windows 10, 8, 7, Vista, or XP.

What Does The Hosts File Do?

The purpose of the hosts file was originally to be what DNS servers do now – map friendly domain names to unfriendly IP addresses.

It’s much easier to remember a domain name like YouTube.com than an IP address like 172.217.1.238. Instead of having to type the IP address into the address bar each time you want to watch YouTube videos, you can just enter the domain name, and the DNS server your device is using will map the name to the right address so you can get to the webpage a lot easier.

The hosts file, since it serves as a sort of DNS server, works the same way. You can enter an IP address that a domain name should be resolved to. In other words, you could order your computer to load a different IP address than the DNS server would, essentially letting you do a few cool things.

Читайте также:  Установить магнитолу windows ce

Why Edit The Hosts File?

One reason to edit the hosts file is if you want a super basic way to block websites from loading on your computer. Enter an invalid or wrong IP address for the site you want to block, and each time you try accessing it, the hosts file will load the IP address you chose. Depending on what you picked, it might completely block the website.

You can use the same technique to make the hosts file block malicious sites. There are even lists of hosts file entries (such as this one) you can download and import into your hosts file to block hundreds of malicious sites or ads.

Another use for the hosts file is to speed up your web browsing. If the DNS server you’re using is down or not working quickly enough, manually entering the IP address and domain name mappings in your hosts file lets your computer find those addresses nearly instantly instead of relying on the DNS server.

Tip: Learn how to use alternate DNS servers to get faster internet access.

Windows Hosts File Location

You need to know where to go to find the hosts file before you can open it for editing. This is the hosts file location in Windows 10 through Windows XP:

C:\Windows\system32\drivers\etc

How To Edit The Hosts File

The hosts file is a text file, meaning that you need a text editor to make changes to it. However, since the hosts file is super basic and doesn’t need to deal with hyperlinks, images, etc., you can use a basic text editor (i.e., there’s no need to use a full-fledged editor like Microsoft Word).

Opening The Hosts File

Let’s start with simply opening the hosts file. We’ll use Notepad, which is built into Windows 10 down through Windows XP.

  • Open the Run dialog box by holding down the Windows key and then pressing R once.
  • Type notepad and then press Enter to open the program.

  • Go to File >Open.
  • In the file name text box at the bottom, type (or copy and paste) the hosts file location shown above and then press Enter.

  • Select the menu to the right of the text box to change Text Documents (*.txt) to All Files (*).

  • Double-click hosts from the list of files to open the hosts file for editing in Notepad.

Editing The Hosts File

There are a few examples in the hosts file to show you how to format your entries. You have to put the IP address first followed by the domain name, and the two have to be separated by at least one space (a tab is a good way to format them).

Here are some examples:

127.0.0.1 www.google.com
13.249.79.104 www.bing.com

As you can see in the image above and read from the directions in the hosts file, the # symbol is used as a comment, meaning that anything that follows it is avoided. This is why the two example lines we give above are useful in this hosts file; they’re not being followed by that symbol.

If you want to block websites with the hosts file, such as YouTube, Amazon, Google, Reddit.com, etc., you can enter a false IP address like 0.0.0.0.

Note: When you enter the URL of the site you want to associate with a specific IP address, be sure to exclude the beginning part and only type the subdomain, such as www or whatever it happens to be for the site you’re adding.

Читайте также:  Termserv dll windows 10

Saving The Hosts File

Here’s how we’ll save the hosts file to make sure it works no matter which operating system you use, which text editor you picked, or how your Windows settings are configured:

  • Go to File >Save As.
  • Change the Save as type option to All Files (*).
  • Rename the file to hosts.backupfile, and then save it to your desktop.

  • Close Notepad and then find the hosts file you just created on the desktop. You want to delete the .backupfile part of the name and leave only hosts (with no period or text after the word).

  • After you do that, click away from the file to something else on the desktop, and confirm the name change when asked.
  • Copy the hosts file.
  • Open the hosts file location you had open before (the etc folder).
  • Paste the hosts file you copied from the desktop, and confirm any overwrite prompts if you see them.

Founder of Help Desk Geek and managing editor. He began blogging in 2007 and quit his job in 2010 to blog full-time. He has over 15 years of industry experience in IT and holds several technical certifications. Read Aseem’s Full Bio

Где находится файл hosts и как его отредактировать

Изменить файл hosts в windows не так уж и сложно, причин его изменения может быть несколько, например вы хотите добавить туда IP адреса какого либо из своих новых сайтов что бы он открывался до того как обновятся DNS, или наоборот запретить определенным сайтам открываться.

Файл hosts в windows выполняет полезные задачи и он необходим, по умолчанию в данном файле у вас будут примерно такие значения:

# 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

И так — для того что бы изменить файл hosts вам нужно сделать следующее:

Перейти по адресу: C:\Windows\System32\drivers\etc после чего в папке ETC вы увидите искомый файл HOSTS.

Для того что бы изменить (отредактировать) файл hosts нужно кликнуть по нему правой кнопкой мыши и выбрать Открыть после чего вы убидите это меню:

В списке программ вам нужно выбрать Блокнот и нажать Ок, после чего файл hosts откроется как обычный текстовый документ, чем он по сути и является. После внесения правок вам останется его стандартно сохранить, как будто вы отредактировали документ .txt.

На это все, теперь вы знаете как быстро отредактировать файл hosts.

Подписывайте на канал , задавайте по данной теме любые вопросы и я вам обязательно помогу. Так же можете внести предложение по теме ‘Создание и настройка сайтов, уроки по Windows’ и следующая статья будет об этом.

Оцените статью