Written in 1998

A year or two ago I got tired of waiting for all those annoying (and often animated) graphics in banner ads to load when I visit various sites, so I started filtering them out using a .hosts file. Several people asked me how to do it, and I soon got tired of sending instructions via email so I wrote this article. Since its original publication there has been a lot of publicity on the issue, especially with the firestorm of controversy over DoubleClick’s merger with Abacus Direct last year.

ZDNet has done several articles on the topic, like Are Banner Ads’ Banner Days Over? and Singing the Banner Blues. The Death of Banner Ads by David Strom outlines some of the arguments against the ads.

This is one of those issues were there are good points on both sides—advertising revenue does help pay for a lot of the content out there. Unfortunately, the ads get fancier and more distracting, and add to your download time for every page. With higher bandwidth connections available to most of us, that isn’t as important now as it was at one time—but it’s still annoying. Also, because of tracking carried out by companies like DoubleClick through the use of banner ads and cookies, there are privacy concerns that are very significant to some people. Also, the graphics and text in some ads are offensive – especially those that come up on Deja.com and other search engines when you get search results that include any kind of "adult content" whether that’s what you were searching for or not.

If you decide you want to do so, there are many options available for filtering out web-based ads. I haven’t used any of them except Norton Internet Security and it does that along with many other things (they bought the product formerly known as AtGuard). Internet Junkbusters has a great list of filtering options—some, like their own Internet Junkbuster Proxy, are free, and others are shareware or commercial products.

Using a .hosts file is free, and has the advantage of not using up much (if anything) in the way of system resources. The downside is that you have to keep the file updated manually, and some sites are now using Javascript and other techniques that get around the .hosts file. Also, it doesn’t catch the banner ads at sites like ZDNet and Deja.com, and some versions of Internet Explorer will refuse to load anything on a page after it finds that it can’t load the banner ad.

If you want to try it anyway, though, here’s how you do it. On a Windows machine, you simply make a plain text file called "hosts" (no file extension) and stick it in your Windows directory. In fact, if you look there now you’ll probably find a file called hosts.sam—a sample hosts file that shows you how to create a real hosts file.

How does this little text file affect your browsing? The standard IP address for referring to "this machine I’m on right now" (also called the "localhost") is 127.0.0.1—any time a TCP application sees that address, it looks on your local machine instead of anywhere else for whatever is supposed to be there. So in the hosts file, all the banner ad servers I know of are listed as being at 127.0.0.1. Instead of going out, finding that server and downloading the ad, your browser looks on your own machine, doesn’t find the file, and gives you a little broken image icon.

The hosts file wasn’t intended for this kind of use, exactly—it’s normally used to cut down on local DNS traffic. You can stick other domain names and their numeric addresses into the hosts file, if you want to save time in getting to them (skipping the DNS lookup step). For instance, www.technomom.com is also 38.209.52.245—I could stick that into my hosts file if I wanted to do so.

If you want to know more about TCP-IP and IP addresses and DNS and so on, check out TCP-IP Introduction.

I know you can use hosts files on Macs but I’m not going to try to explain it—my Mac knowledge is simply too stale. It varies depending on your TCP stack. I found some information that should give you a start, in any case.

I believe Un*x machines use the file as hosts.txt but I’m not going to presume to say—if you know enough to be running your own Un*x box you know more than I do about it anyway.

In any case, you can use my old hosts file as a start—just save it as a plain text file and put it in the proper place. It contains all the banner ad servers I had found when I was using it.