How to block ads using a HOSTS file

In this tutorial i will show you how to block ads, banners, make web sites load faster and save on bandwidth using the built in Windows/Linux OS’s HOSTS file.

What is a HOSTS file:

A HOSTS file is a file that is located in a Windows or Linux/Unix file system, it will usually be located under:

For Windows:

C:\Windows\System32\drivers\etc

For Linux/Unix:

/etc

a sample of a HOSTS file will look like this:

0.0.0.0 adcomplete.com

this means that every request from your PC to adcomplete.com will be redirected to 0.0.0.0, which is a non-routable meta-address. so, for example, lets say that you are browsing to Yahoo.com, in Yahoo.com site there are banners coming from adcomplete.com, these banners will not be displayed in your browser because the request will be redirected to your a non-routable meta-address which returns nothing.

How to do it:

  1. Go to this site http://winhelp2002.mvps.org/hosts.htm
  2. Click the Hosts.zip link and download the file to your Desktop
  3. Extract the zip file to you Desktop
  4. Go to the HOSTS file location in your OS, /etc for Linux or \drivers\etc for windows and backup your original HOSTS file, you can rename it to HOSTS.orig
  5. You can double click the mvps.bat file for an automated process or you can manually copy the HOSTS file inside the zip to the desired location according to your OS, Windows or Linux
  6. Open a CMD window and type ipconfig /flushdns. this will flush the DNS cache, the DNS cache stores IP addresses and their respective web name address. for the OS to refresh the changes that you’ve made to the HOSTS file you need to run this command
  7. Optional: you can open your new HOSTS file using any notepad application, like Notepad++ and add any web address you want and 0.0.0.0 (0.0.0.0 <AnyWebAddress>), this will make this address invalid untill you delete this entry from the HOSTS file
Advertisements
Tagged with: ,
Posted in Computers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: