Hosts Windows

In this post we will see about hosts windows. The hosts file is a Windows system file that can override DNS and redirect URLs or IP addresses to different locations. The hosts file is used by operating systems to map human-friendly hostnames to numerical Internet Protocol (IP) addresses that identify and locate a host in an IP network. The hosts file is one of several system resources that address network nodes in computer networks and is a common part of an operating system’s IP implementation. The computer file hosts is an operating system file that maps hostnames to IP addresses. A file originally named HOSTS.TXT was manually maintained and made available via file sharing by the Stanford Research Institute for ARPANET subscriptions, with hostnames and host names for inclusion by member organizations. Addresses included.

notepad file image


What is the Hosts File in Windows?

The hosts file also known as hosts is a text file used by Windows to map IP addresses to host names or domain names. The hosts file contains lines of text in which one or more host names in the first text field is followed by the IP address. Each field is separated by white space. Comment lines may be included, and they are indicated by the hash character (#) at the first position of such lines. Completely blank lines in the file are ignored. you will need to edit the hosts file on your machine. Sometimes because of an attack or prank, and others so that you can simply and freely control access to websites and network traffic. hosts files have been in use since ARPANET. They were used to resolve hosts names before DNS. hosts files would be massive documents used to aide the network name resolution.


How to edit, update, and reset hosts file on windows?

Steps to edit a hosts file on Windows:

If you want to edit a hosts file on Windows then follow these steps:

  • First, open Notepad as an administrator by pressing the Windows key and clicking “Run as administrator”:
open run administrator image
  • Once you’ve done so, open up the following file using the File -> Open feature.
hosts file image
  • Then you can edit as normal.

Once notepad is open you can edit the file. In this example we will block Facebook. To do this just enter in the following after the #mark.

hosts notepad file
  • Now that you have edited your Hosts file make sure to save it.
hosts notepad file image
  • Now notice if we try to access Facebook in IE we can’t get to the page.
web page image
  • We also were not able to get to it in Google Chrome. Also for more info on editing your Hosts file.
chrome image

Steps to update the hosts file on Windows:

  • Open PowerShell by pressing the Windows key, searching for “powershell”, and clicking “Run as Administrator”.
power shell image
  • In the PowerShell window, enter ipconfig /flushdns to flush the inbuilt Windows DNS:
power shell commmand
  • After that, you should be able to visit localhost in your browser and see whatever you’re hacking on.

Steps to Reset Hosts File to Microsoft Defaults:

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

  • On your keyboard, press Windows Key + R.
  • Type notepad into the Run window.
  • Now click OK.
  • Copy the following text to the Notepad window:
hosts file
  • On the File menu, select Save as, type “hosts” in the File name box, and then save the file to the desktop.
  • Then press Windows Key + R again.
  • Type %WinDir%\System32\Drivers\Etc into the Run window and click OK.
  • Rename the Hosts file to “Hosts.old”.
  • 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.

Hope this post is helpful to you. Thank you!!!