|
BIND as a replacement for Windows Hosts file for the purpose of Ad Blocking
Posted by dosfreak 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. |