Of Zen and Computing

Block unwanted content with Windows’ HOSTS file

Tuesday, June 13, 2006

This trick blocks unwanted content and malicious servers on the Internet so websites can load faster. The trick is to use the HOSTS file in Windows. I’ve only done it on Win2k and XP, but I hear it works on ME & 98 as well. To find the HOSTS file for your OS, go to:

Windows XP
C:\WINDOWS\SYSTEM32\DRIVERS\ETC

Windows 2000
C:\WINNT\SYSTEM32\DRIVERS\ETC

Windows 98 or ME
C:\WINDOWS

Since the file has no extension, you will need to open it in Notepad or WordPad.

The first line should read: “127.0.0.1 localhost”
After that, enter servers to block following the pattern. Example:

127.0.0.1       localhost
127.0.0.1       someserver1.example.com
127.0.0.1       someserver2.example.com
127.0.0.1       someserver3.example.com
etc..

This says that anything hosted at “someserver1.example.com” will get mapped to 127.0.0.1 which is your local machine. Therefore, the content from that server won’t come up, because your computer doesn’t host that image. When I used this in Win 2k using IE, I would see some iframes that didn’t load. These are the frames where content would have been, but since the images couldn’t be resolved on my machine, they came up as unavailable pages.

There are many HOSTS files online that are updated with servers. Also, there is a small maintenance task you’ll need to take care of if the HOSTS file becomes too large: in XP or 2k, if the HOSTS file has too many servers listed, your computer will come to a grinding hault. You need to DISABLE the DNS Client from the system services.

To disable it:
Start > Run > enter “services.msc”
“DNS Client” > Right-click > Properties
“Startup type” > Manual > click Apply/OK
Restart the machine

This is an exceptionally good method of speeding up browsing by blocking access to unwanted content. It’s also a way to avoid some viruses because most updated HOSTS files block known malicious sites.

From time to time, a site you want to browse may get blocked entirely by your HOSTS file. To disable the HOSTS blocking, just rename the HOSTS file.

There are many utilities out there to manage the HOSTS file. I used to use one called “Hostess” but I no longer use any. There are many sites online about this, but this is the one I used many years ago to learn about it all: http://accs-net.com/hosts/what_is_hosts.html

About the author

Contributed by Mark Ursino (www.ursino.info | www.bostonrant.net)

[tags]windows,configuration,hosts[/tags]

File under: Internet Usage, Tips & Tricks, Windows XP

Digg icon StumbleUpon icon del.icio.us icon Facebook icon

Other articles related to this page

© 2006-2008 OfZenAndComputing.com
E-mail Disclaimer | Terms of Service & Disclaimer | Sitemap

Subscription Options
Search Our Archive of How-To Articles and Blog Posts