Jump to content
Compatible Support Forums
Sign in to follow this  
DosFreak

BIND as a replacement for Windows Hosts file for the purpose of Ad Blocking

Recommended Posts

Was re-reading APK's Host file + dialup problems and started tinkering again. Would have done this

 

sooner but I haven't used internet at home since 1998! Only at work or when I visit my paren'ts. Well I

 

decided to hook up my cell phone to the 'net and surf, and what do I find but tons of ads! This

 

immediately made me think of APK and the hosts file. I've never like the Hosts file and I've always

 

wanted to use DNS instead.....the problem was making it easy for a home user to install/configure and

 

understand. So I surfed around for easy ways for Windows users to use BIND and I found it!

 

It is:

 

 

TreeWalk DNS Server

http://ntcanuck.com/

 

This is basically BIND but makes it easier to configure for Windows users. It sets you up locally as a

 

caching DNS server and then forwards DNS requests to DNS servers on the internet. You modify your

 

dial-up or NIC settings to point to 127.0.0.1, since you are the DNS server for your zone.

 

All you have to do next to get it to work is go into the TreeWalk DNS Control Panel and Start the

 

service.....and your done!

 

For me using TreeWalk was faster than using my ISP's DNS, most likely due to BIND than anything else.

 

 

 

Now if you want to block banner ads:

 

Stop your DNS service via TreeWalk DNS Control Panel

Go to \windows\system32\dns\etc

 

Edit named.conf with notepad and add the following line to the bottom of the file

 

zone "sped.atdmt.com" { type master; file "blockads"; };

 

Where sped.atdmt.com = what site you want to block

Where blockads = a file in your \etc directory where you will add the zone info for that site.

 

Ok, so once you have that line added, save the file and now create the blockads file.

 

Now within the blockads file, add these lines:

 

$TTL 24h

 

@ IN SOA localhost. root.localhost. (

2003052800 86400 300 604800 3600 )

 

@ IN NS localhost.

@ IN A 127.0.0.1

* IN A 127.0.0.1

 

 

 

So now whenever you wish to block sites. Simply add another

zone "sped.atdmt.com" { type master; file "blockads"; };

line to the end of your named.conf file (changing the site name of course) and you'll be good to go!

 

 

Go here to convert your Hosts file into BIND config: http://pgl.yoyo.org/adservers/hosts2bind.php

 

 

Some benefits of using this method over Hosts, is that you no longer have to worry about huge hosts

 

lists that seem to make dial-up flaky, (probably due to Hosts file not being designed for such long

 

lists!) and you can easily carry the file over to any Linux system.

Share this post


Link to post

Alright, I almost have a way for the Windows DNS users out here to do a bulk load, but I need a way to limit the domains used to just the domains, and not have any host/sub domains in the file (you don't want to have a zone for each subdomain, as that's wasted space). I have a list of domains, but I would like to trim it. I figure common denominator would be to trim two periods from the end (such as test.fastclick.net and ad1.fastclick.net would be left with fastclick.net when trimmed from the right end). So, any ideas?

Share this post


Link to post

I believe if you remove the last line in your null zone file (blockads file in my post above), that will fix your problems.

 

* IN A 127.0.0.1

 

The wildcard blocks hostnames and subdomains of that domain....so removing this line hould allow the @ IN A 127.0.0.1 line to block that single domain.

 

 

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×