Block Web sites using hosts file

Block Web sites using hosts files

This tip was submitted to the SearchWin2000.com tip exchange by member Bill Downey. Please let other users know how useful it is by rating it below.


An easy way to block access to unwanted Web sites is to alter the contents of the Windows "hosts file." This file will override DNS settings and can help clear up network traffic by blocking selected sites.

The location of the hosts file is different on different versions of Windows. Windows XP = C:WINDOWSSYSTEM32DRIVERSETC
Windows 2K = C:WINNTSYSTEM32DRIVERSETC
Win 98ME = C:WINDOWS

The structure of the hosts file is simple and also contains its own instructions. Entries in this file override DNS settings to directly map IP addresses to hostnames. By designating a local address you can effectively "block" Web sites. When you edit the hosts file, use a simple text editor such as Notepad. The header looks like this:

# Notes: the browser does not read this "#" symbol
# You can create your own notes, after the # symbol
# This must be the first line: 127.0.0.1 localhost

Adding more entries such as:
127.0.0.1 abcsearch.com
will redirect browser requests for abcsearch.com to the localhost, which will not be found and therefore "blocked." This method is very effective for systems that have installed "helpers" such as HotMenu, HotBar and other spyware masquerading as browser add-ons.

This was first published in June 2004

Dig deeper on Microsoft Systems and Network Troubleshooting

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close