How to Edit the Windows Vista Hosts File?

This article explains the purpose of the Windows Host file, including editing or correcting Host file entries. This article applies to Windows 2000, XP and Vista. Users of Windows Vista need to know, and will be shown how to make modifications to the host file using Notepad in administrator mode.

slide 1 of 5

What is the Hosts File?

When you enter a Web site address in your browser, your computer starts the process of resolving the domain name (e.g. www.BrightHub.com) to its IP address (e.g. 66.165.142.74). If for a given domain name your computer finds an entry is the Hosts file the name, resolution does not involve a DNS Server but returns the IP address found in the Hosts file.

In the dynamic World Wide Web it is usually better to leave the name resolution process to the DNS servers which are constantly updated. However, in a number of cases it makes sense correcting Windows Hosts files.

slide 2 of 5

Example Windows Hosts File

The Hosts file is located in the %WinDir% directory, usually C:\Windows\System32\drivers\etc.It can be opened with a text editor such as notepad.Please find below the content of a Windows Vista default Hosts 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.97rhino.acme.com# source server

#38.25.63.10x.acme.com# x client host

127.0.0.1localhost

::1localhost

slide 3 of 5

Adding an Entry to Hosts File

127.0.0.1 is the loop-back IP address of your local computer. So if we inserted the fictive domain UglyAdServer.com

127.0.0.1 www.UglyAdServer.com

127.0.0.1 UglyAdServer.com

we could prevent nasty ads from showing up while browsing the Web, or stop malicious software from phoning home for example. That way you can in fact block access to all websites using Hosts files. Just make sure you really want to block a domain or send your Web requests to a hard-coded IP-address (e.g. 102.54.94.97 for rhino.acme.com ).

slide 4 of 5

Correcting Hosts Files

Assume rhino.acme.com, the example domain Microsoft has put in the Hosts file, was a bogus entry and not commented out. Each time you entered rhino.acme.com in your browser you could be taken to a phishing site! Therefore, you would correct suspicious entries in Hosts files by adding a # or deleting the line.

By the way: Top Anti-Spyware/Antivirus programs such as Webroot 6.1 featured in Bright Hub's review Webroot AntiVirus with AntiSpyware 6.1 prevent unauthorized modification of your Hosts file.

slide 5 of 5

Correcting the Windows Vista Hosts Files

To make any corrections to Windows Vista Hosts files, one has to open Notepad in Administrator mode: Right-click %SystemRoot%\system32\notepad.exe and select Run as administrator; the %SystemRoot% folder usually is C:\Windows. Then go to %WinDir% \System32\drivers\etc and make any modifications you want to Hosts files. Don’t forget to save your modifications using File --> Save!