Reseting the Hosts File

Hi guys,
On this post I will show how to quickly reset your hosts file.
this is probably not something you will do on a daily basis, but it’s a good thing to know how to do it when you debug some problem.
If you are not familiar with the hosts file and what it does I suggest reading this Wiki page.
Basically it holds a list computer name’s and their IP addresses to make the Naming Resolution process a bit faster for your computer – I also suggest reading the Following KB that explains the Naming Resolution Order.
By Default the hosts file comes empty, but you might change if for instance you would like to make Naming Resolution a bit faster, or you would like to add a static Name that differs from the one given by DNS.
So how do you reset it back to the default settings?
First of all will start by “backuping” the current one – simply change the file name from “hosts” to “hosts.BAK”
Now, create a new text file and call hosts – make sure that you leave the extension empty and not txt.
Open the file you’ve just created with a text editor (Notepad.exe) and insert the following lines (according to the operating system you perform it on:
For WinXP of Win2K3:
 # Copyright (c) 1993-1999 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
127.0.0.1       localhost
For Vista of WinK8:
# 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
127.0.0.1       localhost
::1             localhost
For Win 7:
 # 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
More Information can be found on the Microsoft KB972034.
 

Incoming search terms:

  • # copyright (c) 1993-2009 microso ft corp # # this is a sample hosts file use d by microsoft tcp/ip for windows # # this file contains the mappings of ip addresses to host names e ach # entry should be kept on an indi vidual line the ip address shoul d #

What do you think about this post?