X
X

Knowledge Base

HomepageKnowledge BaseServer/VPS/VDSA Step-by-Step Guide to Editing the...

A Step-by-Step Guide to Editing the Hosts File in Windows 10

A Step-by-Step Guide to Editing the Hosts File in Windows 10

How to Edit the Hosts File in Windows 10 : Simplified Instructions

The hosts file is one of the fundamental system files of all Windows operating systems that allow the mapping of IP hosts to host names. It is employed by the operating system in name resolution and can be altered to filter out specific sites or to redirect traffic to those sites. Below, we show you how to do it step by step on the Windows 10 operating system is detailed in this guide.

Why Would Anyone Edit the Hosts File?

Editing the hosts file can be useful in various situations:

Blocking access to unwanted websites:

You can stop the unauthorized user from accessing certain websites or domains by closing those IPs in hosts file. This may be considered when trying to lock the system from accessing some sites that are not good for work or school, or when trying to lock a work or school computer from accessing some sites that are not good for work or school.

Redirecting traffic:

This can be achieved with the help of domain mapping where the IP address of the first domain is set to correspond to the IP address of the new or different domain.

Testing website availability:

By changing the IP address of the web on a temporary basis, people can easily determine whether or not a given website can be accessed on another server or network.

These are the steps you need to follow to edit the hosts file in the Windows 10 operating system.

To manipulate the hosts file one needs to have administrative rights; other wise, any mistake can lead to some system utilization issues or problems with connection to a particular address. undefined

Step 1: Go to the Start menu of the computer and look for Notepad to launch the application.

The user can open Notepad in the Windows 10 operating system by clicking on the Start button and then typing the words "notepad" in the search bar on the taskbar.

Step 2: The mouse pointer should be placed over the icon of Notepad and then you should right-click on it and then select the option Run as administrator.

Select Start and go to Programs where Notepad is located, right click on it then go to the option that says Run as Administrator. This will start Notepad in the administrative mode.

Step 3: There is a file known as the hosts file and it is located in a specific part of the personal computer and this is how to open it.

In Notepad, click on "File" > "Open" and navigate to the following directory: In Notepad, click on "File" > "Open" and navigate to the following directory:

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

Right-click the hosts file and click on Open as it should be highlighted.

Step 4: Add, Insert or Modify

These are plain text files; you can open them with Notepad, read, and even modify the hosts file as you wish. An entry in the file is characterized by an IP address and one or several hostnames written one after another with no delimiters between them but with a space character after each hostname.

For example, to block access to a website, you would add an entry like this: For example, to block access to a website, you would add an entry like this:

127. 0. 0. 1 example. com

This will map the IP address 127. 0. 0. 0 Most significantly, the single record (1, localhost) is mapped to the domain example. com. Any requests for example. Any request to the domain com will be pointing to localhost.

Step 5: The changes have to be saved.

That completes the information you want to add in into the template, next step would be to click on "File" then "Save" or use the shortcut control + S, to save the changes you have made in the template.

Step 6: Clear the DNS cache

Finally to implement the changes you have made you have to reload the DNS cache. You can do this by running the following command in Command Prompt:

ipconfig /flushdns

Instead, you can either restart your computer or restart your network connection.

This section presents common issues and solutions or pointers that may help solve the problem.

Error: Notepad tip: If you get "Access denied" when attempting to edit the hosts file then you are probably not running Notepad as an administrator.

Error: If you could not find the hosts file, it is likely that you have not searched the right directory which is C:\Windows\System32\drivers\etc\hosts.

Entry not working: Some of the suggested measures when an entry is not functioning properly include; closing and reopening the computer or refreshing the DNS cache.

Hacks on how to edit host file

Be cautious: One should bear in mind that editing the hosts file is likely to produce additional effects, so extra vigilance here is appropriate. Use a backup: Before modifying the hosts file, make a copy of the original contents in case of getting it wrong.

Test before deploying: To avoid any form of complications or system failure affecting your production network, first run your changes on a staging network.

Conclusion

Windows Hosts file is an effective option in Windows 10 that can be used as a means for blocking access to certain domains, for leading the traffic to such site, and for checking the availability of certain websites. With the steps and suggestions, you are able to modify hosts file safely without bringing down your system or affecting your network connection.

Can't find the information you are looking for?

Create a Support Ticket
Did you find it useful?
(34 times viewed / 0 people found it helpful)

Top