Kill/Block Ads Using Hosts File

October 4, 2007 at 8:00 am (General, Operating Systems, Tips n Tricks)

I know its annoying to face ads everywhere along the web pages. Here is a way to get par from it.

Hosts File: This is file which does the job of DNS for the host. example is termed as localhost. This entry is there in the host file. You can find the host file at C:\WINDOWS\system32\drivers\etc\ This hosts file has an entry like localhost

Online Ads : There are hardly any sites who place their own ads. Instead they take ads from a different ad server. The trick is to block the ip address of the ad server.

Trick : The trick is to make an entry of the ad server in the hosts file. And the ip corresponding to it will be the local loopback ip address. i.e. Now, whenever request for the adserver is fired then the entry in the hosts file is checked first. Which checks loopback address( that return nothing).

Eg. I tried this for a site named

Before Removing

Watch out the ads on the top posted by google server. Right click on any of them and go for copy link option in the popup.

When pasted we get the link location as

So, make an entry in the hosts file and it looked as localhost

Now, restart the browser and try the site again this is what I got.. 🙂

After Updating

Leave a Reply

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

You are commenting using your 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: