Call us Toll-Free:
Email us


How to use BIND as a simple nameserver

Michel Nadeau, 02-19-2009
From time to time, our dedicated servers hosting company's DNS servers are going down. It's never for a very long time but, even for a few minutes, it's something we really can't accept because everything stops working correctly.

To fix this situation, we decided to install and configure our own DNS servers. We're not delegating any domains to these servers - only using them as local nameservers on our servers.

This quick tutorial will tell you how to achieve this on FreeBSD (may also apply to other Linux versions with some minor BIND configuration file modifications).

1. Install BIND

In our case, BIND was already installed on all our servers. The version we're using is BIND 9.3.5-P2. To install it, simply do this:

cd /usr/ports/dns/bind9
make all install

2. Configure BIND

To use BIND as a simple nameserver, no special configuration is needed; the default configuration file is perfect. The configuration file is located here:


If you have specific configuration needs, just do them in that file.

3. Start and test BIND

Now that BIND is installed and configured, you're ready to start and test it. To start BIND, simply do this:


Now to test it, just use nslookup specifying the DNS server to use like this:

nslookup localhost

This will lookup using localhost as the DNS server. Do many tests, including the hosts your scripts may use the most.

You can also run BIND in foreground mode instead of daemon, so you can see debug information directly on-screen. To do so, simply start it like this:

named -g

You can also control the amount of debug information with the -d (debug level) switch. Just specify a debug level (numeric) from 0 to 100. For example:

named -d 100 -g

Now using another session you can issue nslookup commands and see what's doing the BIND server on-screen.

4. Rolling BIND live

When all your tests are satisfying, you're ready to roll the BIND server live! To do so, simply edit this file:


Simply add, on the FIRST line:


NOTE: DO NOT use "localhost" or a hostname - resolv.conf only accepts IPs (on FreeBSD, at least).

resolv.conf tells your operating system what are your DNS servers, in order of priority. We HIGHLY recommend that you keep your other DNS servers as secondary servers, so if there's a problem with your BIND server, your operating system will use the secondary servers.


Voila! In a couple of minutes, you have your own local nameserver and you don't need your hosting company's DNS servers anymore (except in case of backup).

Dawn Rossi, 02-26-2009
Sample bind config file:

$TTL 60 IN SOA (
20090220 ; Serial number
60 ; Refresh
900 ; Retry
864000 ; Expire
60 ; Min TTL

; Host records IN A IN A

; Mail servers MX 10 IN A


; Alternate DNS Servers IN NS IN NS IN NS IN NS

Adrian Singer, 12-13-2009
To reload Bind's named.conf file, use:

Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

Post your comments

Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.

About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions