29. January 2004, 22:09 | by WD Milner | Full Article |

The details collectible via on-line advertising and the various privacy concerns surrounding them have been discussed extensively in many venues. These issues aside, most of these ads are just plain annoying. Whether they be banners, pop-ups or pop-unders, they all use bandwidth and get in the way. There are dozens of programs, free, shareware and commercial that can be used to block them, but there is another way that is smiple, and involves only the use of a basic text editor.

To understand how this works, a brief look at the way addresses work on the Internet is needed. Most people are familiar with the names of web sites, their domain names (eg. Every web site is also accessible using a numeric address as well called an IP address (eg. 321.456.790.602). The translation of the human friendly domain name into the machine friendly IP address is done by a Domain Name System (DNS) server.

Most operating systems provide a mechanism to bypass the the DNS lookup by hard coding the IP addresses for a specific domain in a special file called the “Hosts” file. This is a plain text file containing a list of IP addresses and domain names where each line consists of an IP address, one or more spaces, a domain name and an optional comment indicated by “#”. Anything which appears between the “#” and the end of the line is ignored as a comment. An example line from this file might look as follows:     # Microsoft Canada web site

When you request a web site from your browser, if there is an entry for the domain in the Hosts file, no DNS lookup is required as the address associated with the domain in the Hosts file is used. When the browser requests a banner, for example, from an advertiser’s web site and the request fails no advertising will appear. This failure can be forced by using the Hosts file to associate the advertiser’s domain name with the wrong IP address.

There is a special IP address associated with every system, which represents the localhost, your computer. If you associate an advertiser's domain name with the localhost IP address, any requests for URLs in that domain will quickly return an error message. More importantly, since the domain is completely blocked, there is no contact between the advertiser’s server and your machine so there is no revealing of IP address or cookies and web bugs fail. Pop-ups and pop-unders may still appear, unless you have blocked the scripts, but there will be no content.

Compiling a Hosts file can be a daunting task. There are a number of pre-compiled files available that can be turned up by a search for “ad blocking” and “hosts file”. Make sure you back up your original before replacing it with a new file, and copy any n0n-comment lines from the old one, to the new one. Clear the browsers cache to eliminate any ads that may have slipped through. If you find a site you normally visit isn’t accessible, check the newly downlaoded Hosts file. Someone may have considered it worth blocking and listed it in the file. If it is there, you can either remove the line or palce an “#” at the beginning of the line to comment it out.

Default locations for Hosts files

  • Most UNIX like operating systems:   /etc
  • IBM OS/2 (and eComStation):   \mptn\etc\
  • Apple OS X:   /private/etc
  • MacOS:   System Folder:Preferences
  • Windows NT/2000/XP/Vista:   \Windows\System32\Drivers\etc
  • Windows 95/98/ME:   \Windows
  • Novell Netware:   SYS:\ETC

On some systems, a large Hosts file may interact with other processes and slow Internet or network access. If this is too pronounced, restore your original file and use a different method for ad blocking. The Hosts file technique cannot block ads on a site you can view, nor will it work if an advertiser uses the numeric IP address to access their server. Despite these limitations it is effective, foolproof and free!

- 30 -

Categories: ,
Keywords: hosts file,ad block,free,dns,ip



Textile help
* Indicates a required field.

As a SPAM prevention measure, comments are moderated and will be posted once vetted.


Article & Comments

Comments are not enabled for all articles or documents.

Article Navigation


Internet and WWW
Music and Audio
Society and Culture
Stage and Screen
Tips and Tricks
Web Design
Web Site

The Birches - Support Child Safety Online


 Help to FIGHT spam!