Facebook Twitter Stumbleupon Reddit del.icio.us Technorati Digg it


What is the Windows Hosts File?

The hosts file is a plain-text file used in an operating system to map hostnames to IP addresses. Each website on the Internet has an IP address associated with it. The hosts file maps these IP addresses to the actual domain name. Generally the clean hosts file only has one entry for localhost. Localhost is the host name given to your PC. The IP for localhost is 127.0.0.1. Any domain name in the hosts file associated with the IP 127.0.0.1 will not access the Internet and is essentially trapped on your computer. For this reason, security programs can use the hosts file to make your computer more secure, but viruses can also edit the file and cause your computer not to be able to access the Internet. The lines started with a pound sign (#) are comments.


An uninfected hosts file that is not being used by any other programs to restrict access should look similar to the following file:

# 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

Where is the Windows Hosts File Located?

Here are the locations of the Hosts file in various Windows operating systems:

  • Windows 95 - C:\Windows
  • Windows 98 - C:\Windows 
  • Windows Me - C:\Windows 
  • Windows 2000 - C:\Windows\System32\Drivers\Etc 
  • Windows XP - C:\Windows\System32\Drivers\Etc
  • Windows NT - C:\Windows\System32\Drivers\Etc
  • Windows 2003 Server - C:\Windows\System32\Drivers\Etc
  • Windows 2008 Server - C:\Windows\System32\Drivers\Etc
  • Windows Vista - C:\Windows\System32\Drivers\Etc
  • Windows 7: C:\Windows\System32\Drivers\Etc

Can I Fix a Hijacked Hosts File manually?

Since the Hosts file is a plain text file, it can easily be edited with Notepad or any text editor. Open the Hosts File in Notepad, make the appropriate changes and resave the file.

1) Open the appropriate location on your computer from the list above.
2) Double-click on the Hosts file and choose to open with Notepad
3) Delete any lines without the (#) except for the localhost entry from above.
4) Save the file. If you are unable to save the file, a virus or malware has probably changed the file permissions on the hosts file. To fix this issue, follow these steps:

1) Download hosts-perm.bat from Bleeping Computer to your desktop
2) Double-click on the host-perm.bat file and run it. It may ask your permission to run, please allow it to run. It should only flash a window on your screen and disappear. It should only take a second.
3) Now try opening the hosts file again and resaving it.

Automatically Reset the Hosts File

Microsoft has created a Fix-It tool to reset the hosts file. Just download the fix-it and run it to reset the hosts file. Although because its fairly easy, I would probably just edit the file manually using the above instructions.




Recommended Software for PC Hell Visitors