Blocking Intrusive Ads and other evil traffic
How many of you remember a time when the Internet wasn’t cluttered with intrusive ads and lame phishing attempts? I do, and I wish it could go back to that state. Recently I have noticed a major increase in popup, pop under and animated ads on websites with large user bases. As you can see from this site I have nothing against using ads, I just wish Webmasters would do it in some sort of ethical manner. Statistics show that intrusive advertising does NOT work so why do these Webmasters continue to load even more of it onto the web?
Due to these annoying ads I am now forced to implement ad-blocking solutions on my home and work networks. It sucks because I like to support sites that use non-intrusive ad methods but some people have ruined that for everyone, at least in my case. For those of you who need an ad-blocking solution I have outlined the methods I am currently using below.
The 1st step is to change the DNS servers your network is using over to OpenDNS. Though not directly related to ad-blocking OpenDNS is generally a faster DNS then the DNS servers provided by your ISP and protects against phishing attempts. Corrects misspellings and allows you to block sites easily via their online interface among other things.
To setup OpenDNS visit http://www.opendns.com/ and follow the instructions for the hardware you are using. In short all you need to do is change your networks DNS servers to 208.67.222.222 and 208.67.220.220 (on your computers network connection if you are directly connected or via your routers admin interface if you are on a network) and optionally create an account via the OpenDNS website for all the bonus features the service provides.
Now if your not using Mozilla Firefox as your browser I suggest you start doing so. Mozilla has pretty good built in popup blocking and two great extensions called Adblock and Adblock Filterset.G Updater. If Firefox is already installed type “about:config” into your browser and in the filter box type dns, it should return a result of network.dns.ipv4OnlyDomains along with a few others. Change the value of network.dns.ipv4OnlyDomains from .doubleclick.net to true.
Now go to https://addons.mozilla.org/en-US/firefox/addon/1136 and
https://addons.mozilla.org/en-US/firefox/addon/10 and grab the Adblock and Adblock Filterset.G Updater extensions. If Firefox isn’t installed, install it, follow the steps above and then grab the extensions. This extensions are an optional step as the next step accomplishes the same task (in some ways) but I like to have as many layers of protection as needed within reason. Avoid Adblock Plus as it has some memory management issues.
The SafeHistory extension for Firefox is another worth mentioning, it allows control over cookies and allows you to defend against some web privacy attacks. The extension can be found here: https://addons.mozilla.org/en-US/firefox/addon/1502
In Firefox, Tools>Options>Privacy tab> you can manage how the browser deals with cookies as well, for those of you who are really paranoid, set the cookies to be deleted when the browser closes. You can also mange what sites are allowed to set cookies within Firefox.
The next step that is needed is to go to http://everythingisnt.com/hosts.html and grab the installer for “Mike’s Ad Blocking Hosts file” (if your using *nix grab the file for manual installation) The site explains installation in a rather simple format so let’s skip ahead. So you have the ad blocking hosts file installed but you notice the surfing is a little slower. What you need to do is browse to the directory where the file is installed and modify the entries in the hosts file, for those of you who used the Windows installer the directory is:
XP: c:\windows\system32\drivers\etc
2000: c:\winnt\system32\drivers\etc
95/98: c:\windows
Open the hosts file with your favorite editor and change all instances of 127.0.0.1 to 0.0.0.0. On Linux I use vi, on Windows I use Editpad lite as it is free, lightweight and has the search and replace functionality. This will stop the looping connection attempts to your local machine when you browse to sites which contains ads blocked via the host file. One thing to note is that using 0.0.0.0 may cause issues with some applications. If you notice an issue you can always change it back to 127.0.0.1.
Depending on your setup there are other ways to accomplish ad blocking on a network wide basis such as blocking via an internal DNS server. I may cover solutions like this if there is a interest, until then this should help the average user block ads and some malicious traffic.


September 16th, 2007 at 7:43 pm
Great write up, Id like to add another option for handling host files that I have implemented across my network. It’s called Hostman and can be found here: http://www.abelhadigital.com/
It works great and allows for you hosts file to be disabled if you say run into a trouble site where something is not showing when you want it to (myspace, prezhilton, and others).
Great post though man. Everyone needs to check this out.