Alternate Approach

As described in the original article, my approach redirects advertising banner requests to a non-existent web server at IP address 127.0.0.1. This may not be the best idea for a couple of reasons. First, some web browsers generate unwanted error pop-ups when redirected to a non-functioning web server. Also, some web pages may not display properly if no image is returned to take the place of the original advertising banner.

One of our readers, Mike Kinney (kinneym@redacesolutions.com), suggested an alternative. Rather than redirect traffic to a non-existent web server, instead point the advertising domains to a local web server. Obviously, when the request goes to the local web server, it's going to generate a "404 Not Found" error because the expected banner image won't exist on the local server. However, it's very easy to configure your local Apache server to return a custom error document for various error codes. In our case we simply configure the Apache server to return an innocuous GIF image instead of the normal "404 Not Found" error page:

	ErrorDocument 404 /dummy.gif

This GIF file could simply be blank, or perhaps it should display a message like "This banner ad intentionally replaced".

Once you've go your local web server all set up, replace the two "127.0.0.1" entries in the original dummy-block file with the IP address of your local web server. Don't forget to also update the serial number in the SOA record in the dummy-block file so that your changes will be picked up. After updating the dummy-block file, restart your name server.

Now start surfing. If everything is configured properly, instead of the normal banner ads you should be seeing your dummy GIF.

Help from Other Sources

Bill Stearns (wstearns@pobox.org) has been maintaining a blacklist of known spam and advertising domains with the help of a cadre of other contributors. Bill automatically converts this list of domains into a variety of formats-- for a complete list see this page.

In particular, however, Bill's scripts produce this version of the domain list. As you can see, this file is designed to be incorporated directly into your named.conf. You can either append the contents of this file directly to your named.conf, or simply include the file with a directive like:

	include "/some/dir/sa-blacklist.current.dummy-block";

Obviously, it's up to you to download the file from Bill's web site and install it in the appropriate directory.

Return to: Deer Run Home > Hal's Homepage >