Block thousands of Ads with HOSTS

 by Brett
In this instructable, I will show you an easy way to block nearly thousands of advertisements, in one simple, easy method.
 
Remove these adsRemove these ads by Signing Up

Step 1: About Window's HOSTS File

Before we start, it is important to understand exactly what the HOSTS file is.

The HOSTS file is a file with IP addresses, corresponding to a domain name, that windows references and bypasses DNS with.

For a more in-depth explanation, please visit Wikipedia's definition:
http://en.wikipedia.org/wiki/Hosts_file
purgedsoul says: Aug 18, 2006. 7:42 PM
If you are using firefox, get the Adblock extension. If you are using IE, get Firefox, then get Adblock.
Arbitror in reply to purgedsoulDec 6, 2008. 9:45 PM
But the good thing about this, is that It works for ANY browser.
Not saying that firefox is bad...
zeero360 in reply to purgedsoulJan 1, 2008. 6:55 PM
If you are using IE, get Firefox, then get Adblockhahahahaha, 1 problem i cant hahahahahahahahalol
zeero360 in reply to zeero360Jan 1, 2008. 6:56 PM
fyi im retarted not really but in a sence
Erik Andersen in reply to purgedsoulDec 20, 2007. 6:25 PM
I can't agree more with Purgedsoul. I have Firefox (w/ Adblock Plus of course!) and it works like a charm. You might get the noscript extension too so you can visit sites that block Firefox (they don't like the ads bypassed!).
JWALLIS says: Sep 4, 2007. 6:23 AM
I am not an expert, so do correct me if I"m wrong.

Having a large host file can slow a PC down to a crawl.
Use Peerguardian instead ( without logging)

I do keep <10 entries in the host file for an absolute deny policy.

Sometimes, I'll be attacked: My DNS will be changed and Peerguardian (PG) blocks all connections. I examine the address PG is block and put it in my hosts file. If possible, try to remember the site that started everything and block that too.

So - my opinion: keep the hosts file small (unless maybe its on another (*nix ) machine)[proxy?]
Brett (author) in reply to JWALLISSep 4, 2007. 1:20 PM
I agree 100% Back when I did this, i meant for it to be a quick & easy fix.
binnie says: Feb 9, 2007. 8:35 PM
should of known how to do that. it looks for .... and replaces it with 127.0.0.1 but, if you set apache up to broadcast on 127.0.0.1, does that mean your site will become the ad? yes think so
Brett (author) in reply to binnieFeb 10, 2007. 7:51 AM
Yes. If you didn't want this to happen, you could always use spinach_dip 's suggestion: "try using 0.0.0.0 instead of 127.0.0.1"
RyanPotter says: Aug 16, 2006. 10:29 PM
Yeah, I learned how to do this a year or two ago, and it's nice that there's no ads, but the "This page can not be displayed" things all over can still be a bit annoying. This method is also great for pranking people! Just redirect one site to another... It'll really confuse people!
binnie in reply to RyanPotterFeb 9, 2007. 8:36 PM
set up a local server to display what ever you want!
zachninme says: Sep 24, 2006. 4:07 PM
I just block media.fastclick.com (and fastclick.com). Those are the only "intelligent" popups I run into. (The "intelligent" popups popup when you click on something, bypassing most popup blockers.)
JP says: Aug 23, 2006. 9:41 PM
You can do this easily with http://www.dnsredirector.com
Brett (author) says: Aug 16, 2006. 4:10 PM
Also, if you have a DNS server that you have access to, you can add entries there instead of your hosts file, making the changes noticeable for your whole network, or whatever is connecting to your DNS server. Brett
rotor says: Aug 16, 2006. 2:37 PM
This will work, but has problems people should be aware of, as detailed here:

http://www.windowsdevcenter.com/pub/a/windows/2004/03/30/hosts.html

In particular, if you use firefox or opera, you'll be waiting a long time for all those connections to localhost to time out.
spinach_dip in reply to rotorAug 16, 2006. 3:24 PM
try using 0.0.0.0 instead of 127.0.0.1
spinach_dip says: Aug 16, 2006. 2:31 PM
This is a good deal. I've actually switch to using Adblock + Filterset G updater + my own custom block list. I've done this because it's more flexible, and I can disable it instantly without a reboot or restart of my browser. However, I've started using the Hosts file again because of my stand alone Aggregator was, with all the ads, turning into an aggravator. It's just targeted a bit better.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!