Block Thousands of Ads With HOSTS

8,895

10

17

In this instructable, I will show you an easy way to block nearly thousands of advertisements, in one simple, easy method.

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

Step 2: Download Replacement HOSTS File

There are many replacement HOSTS file out there, so experiment and determine which one you like best. I personally use the MVPS malware prevention HOSTS file. It does fine for me.

The MVPS HOSTS file I've used is located here:
http://www.mvps.org/winhelp2002/hosts.txt

Simply save this file to your desktop, temporarily.
(Right-Click, Save Target/Link As..)

Step 3: Navigate to and Backup Default HOSTS File

Our next step is to find the HOSTS file on your computer.

Here are some of the default locations for the Windows HOSTS file from Wikipedia.

  • Linux and other Unix-like operating systems: /etc
  • Windows 95/98/Me: %windir%\
  • Windows NT/2000/XP/Vista: %SystemRoot%\system32\drivers\etc\ is the default location, which may be changed. The actual directory is determined by the Registry key \HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath .
  • Mac OS: System Folder:Preferences or System folder (format of the file may vary from Windows and Linux counterparts)
  • Mac OS X: /private/etc (uses BSD-style hosts file)
  • OS/2 and eComStation: "bootdrive":\mptn\etc\
  • Novell Netware: SYS:\ETC

If you can't find it, Start -> Search is always a good tool to use :).

Once you successfully navigate to the HOSTS file, rename is from "HOSTS" to "HOSTS.backup".
Doing this, you will always have a backup of your default HOSTS file if for some reason you want to revert to it.

Step 4: Copy New HOSTS File

Next, copy and paste the "HOSTS.txt" file from you desktop to where your default HOSTS file was.
After the file is copied, rename it from "HOSTS.txt" to just "HOSTS".

NOTE: You maybe have to edit your folder settings to not "Hide extensions for known file types" by going to Tools -> Folder Options -> View -> Uncheck "Hide extensions for known file types".

Step 5: Finish!

You have now replaced your HOSTS file!
Congratulations.

It may take a few minutes for the changes to become active. You may also have to close all internet browser windows.

Enjoy internet browsing with minimal ads!

Share

    Recommendations

    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest

    17 Discussions

    0
    None
    purgedsoul

    12 years ago

    If you are using firefox, get the Adblock extension. If you are using IE, get Firefox, then get Adblock.

    4 replies
    0
    None
    Arbitrorpurgedsoul

    Reply 9 years ago on Introduction

    But the good thing about this, is that It works for ANY browser.
    Not saying that firefox is bad...

    0
    None
    zeero360purgedsoul

    Reply 10 years ago on Introduction

    If you are using IE, get Firefox, then get Adblockhahahahaha, 1 problem i cant hahahahahahahahalol

    0
    None

    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!).

    0
    None
    JWALLIS

    11 years ago on Step 5

    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?]

    1 reply
    0
    None
    BrettJWALLIS

    Reply 11 years ago on Introduction

    I agree 100% Back when I did this, i meant for it to be a quick & easy fix.

    0
    None
    binnie

    11 years ago

    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

    1 reply
    0
    None
    Brettbinnie

    Reply 11 years ago

    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"

    0
    None
    RyanPotter

    12 years ago

    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!

    1 reply
    0
    None
    binnieRyanPotter

    Reply 11 years ago

    set up a local server to display what ever you want!

    0
    None
    zachninme

    12 years ago

    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.)

    0
    None
    Brett

    12 years ago

    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

    0
    None
    spinach_diprotor

    Reply 12 years ago

    try using 0.0.0.0 instead of 127.0.0.1

    0
    None
    spinach_dip

    12 years ago

    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.