Set up Caching Nameserver on Windows using BIND
By Reaper-X on Jul 10, 2008 in DNS Server, Tutorials, Windows
I think most of you who are running Linux as the operating system already know that you can set up a caching nameserver on your home computer in order to speed up dns queries. But what if you’re on Windows and want to achieve the same thing (cache dns request)? Well thanks to BIND port for Windows, now you can also set up your own DNS Server on Windows easily (although in my case because my ISP DNS Server often down and running CentOS inside Virtual Machine just for this purpose isn’t all that useful considering there’s already a port of BIND / Named for Windows).
And to make things short, let’s get straight to the point ;)
1. First you’ll need to grab Bind from the ISC homepage (grab the Windows version of course), and at the time i wrote this, the latest Bind / Named version is 9.5.0–P1
2. When you’ve finished downloading BIND, now just you need to extract it somewhere on your harddrive and then followed by running BINDInstall.exe to install BIND. But first as a note, in this example i choose to Install BIND into C:\BIND
3. After the installation process finished, you’ll need to set up an environment variable path first to make it easier for you to call various BIND tools from any directory inside the command prompt. To do this you just need to go into Control Panel -> System -> Advanced -> Environment Variable. And then add / edit PATH to your BIND\bin directory … and based from this example the BIND\bin directory would be C:\BIND\bin
4. Now you need to create two folders / directories inside your BIND directory, let’s called it log (the end result would be C:\BIND\log) and zone (C:\BIND\zone)
5. Now to set up caching nameserver on windows using bind (so you can start the BIND service), you need to create a filename inside the etc directory under BIND directory called named.conf and then write these lines into the named.conf
options {
directory "c:\bind\zone";
allow-query { localhost; };
forwarders { XXXXXX; XXXXXX; };
forward only; query-source address * port 53;
};
logging {
channel queries_log {
file "c:\bind\log\queries.log";
print-severity yes;
print-time yes;
};
category queries { queries_log ; };
};
zone "localhost." IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa." IN {
type master;
file "localhost.rev";
allow-update { none; };
};
include "c:\bind\etc\rndc.key";
Note: Change XXXX into your ISP DNS Server, and also i put a logging for every request made but you can always turned off the logging feature if you want
6. Now you need to create two files inside the zone directory (C:\Bind\Zone) called localhost.zone, and localhost.rev and then write these lines:
localhost.zone
$TTL 86400
@ IN SOA @ root (
42 ; serial
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS @
IN A 127.0.0.1
IN AAAA ::1
localhost.rev
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
7. Now you need to open the command prompt and type:
cd C:\BIND\bin
rndc-confgen -a
8. Now go into windows directory -> system32 -> drivers -> etc … and create a filename called resolv.conf and write this line into resolv.conf
nameserver 127.0.0.1
9. Now we need to start the BIND service first. To do this you just need to type services.msc from the RUN Command or you can also get into Windows services from Control Panel -> Administrative Tools -> Services … and then start the ISC BIND service
10. Since everything has been configured, the last step would be testing it of course, to do this you just need to go into the command prompt and type:
dig reaper-x.com
At the first time you’ll see something like this (note: result may vary)
Query time: 453 msec
Now type (again)
dig reaper-x.com
and if you get (or at least the query time gets reduced)
Query time: 0 msec
11. Finally you just need to change the preferred DNS Server in your connection into 127.0.0.1 and you're done
That means you’ve configured your caching nameserver using BIND on windows to cache dns request, congrats :)
But wait, what if you want to flush your dns cache? .. in order to flush your dns cache, all you have to do is just execute this command in the command prompt
rndc flush
Well basically that’s all about it :)

Website RSS Feed
Stumble this post
Bookmark this post on Del.icio.us
Submit this post to Digg
Submit this post to Reddit
Print this
Trackback URL












Hello,
Thank you so much for this tutorial.. I was searching for a way to make a caching server on windows for a long time.
Your welcome Jack glad you like it :)
Reaper-X
Thank you. I am facing the problem to host the webpage with my own computer. I would try to set it up according to your great guidelines.
Try my best now.
Hi Reaper,
i got a problem at step 9; trying to start the isp bind service ... when i click START a error 1069 pop'up "the fail of openning a session fail the start of this service" ... ty to debug me :P
Gamach, i just search the net for your problem and found this page
Based from that page, i'm guessing that you're experiencing the same problem like on that page too (although it's for sql server)
So try to check the ISC Bind service logon to use the username created specifically for Bind (the installation process ask you this) and don't forget to use the same password when creating the BIND service