Online ads are annoying but they make a lot of content free on web. At times I feel like I am browsing just the ads though.
There are plug-ins for Firefox and IE to block ads but I use Opera. Opera has inbuilt content blocking but that is too much to do as there are a zillion ad servers out there. At times I have to use FF or IE too and this leaves me managing three different applications to block ads. On top of that, putting a plug-in in the pipeline is again adding one more step before you can see the content. And then you have to keep updating them for new releases. Not a good idea, I’d say.
Another way is to use hosts file. Description of hosts file from wikipedia:
The hosts file is a computer file used to store information on where to find a node on a computer network. This file maps hostnames to IP addresses. The hosts file is used as a supplement to (or instead of) the domain name system on networks of varying sizes. This file is (unlike DNS) under the control of the user who is using the computer.
There is a lot of information available on internet which you can use to make it work. In a nutshell, here is what you need to do:
- Download a hosts file which has updated lists of ad servers. I’m using one from here and added few missing servers. Can you believe this list has around 6000 entries already? And if you follow the link, please don’t try those shock sites. 😦 More hosts files can be found here.
- Create a backup of your existing hosts file. (just give it an extn say .old.) On Vista, hosts file can be found in [System Drive]:\Windows\System32\drivers\etc. See this to locate on other systems.
- Copy the downloaded hosts file in the etc folder. If you are using the site which I did then create another hosts file in etc folder and paste the contents from browser. See this if you are trying to edit the hosts file on Vista when UAC is enabled.
- And that’s pretty much it. Try some ad plagued site like engadget and you should see blank space instead of ads.
- Also, don’t forget to update the hosts file as frequently as you can as more and more servers will be popping out every now and then.
Here are few links to learn more:
- Ad Filtering (Wikipedia)
- All about blocking ads
- The hosts file I’m using
- MVPS Site related to the subject.
PS: The hosts file I am using and gave the link above has entries for known malware, trojans and user tracking sites too. It also has entries for ad servers like yahoo, msn and others which can make some sites behave unexpectedly. Please see inline comments on the site.
2 thoughts on “Using hosts file to block Online Ads”
I have never really run into this problem. Would you suggest going through the work to block these ads from bogging you down if it is not necessary.
It depends. If you browse a lot of community sites (blogs, forums and what not), ads make a significant contribution. But if you feel comfortable, I’d say keep the bits flowing. 🙂