Resolving Domains Internally And Externally With Bind9 And Caching Nameserver - Page 2

5. Zone File Creation:

Now there is an issue. :( Where is my shotgun? 

I.e. if you have installed bind-chroot, then you will be creating your domain zone file in /var/named/chroot/var/named/ directory, and then you will make a softlink to the /var/named/ directory, but if you didn't install this chroot package, then you are going to create the zone file directly in the /var/named/ directory.

Now the following command works fine, if you have bind-chroot:

$ vi /var/named/chroot/var/named/

OR   (if bind-chroot is not installed)

$ vi /var/named/  

and type the following lines into your zone file:

$TTL    86400
@               IN SOA  @ (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
@               IN NS 
nameserver      IN A  
cache           IN A  
www             IN A  
portal          IN A  


You can add as many records as you wish :) in this file. 

Note: Here I am assuming that our DNS machine name is nameserver and LAN subnet is on , you can change this according to your situation.

Now the following step is needed only if you have created the zone file in the /var/names/chroot/var/named/ directory.

$ ln -s /var/named/chroot/var/named/ /var/named/


6.  Editing resolv.conf:

Now to tell our nameserver machine about the order it will look for name resolution, we have to edit /etc/resolv.conf file,

$ vi /etc/resolv.conf

and write the following two lines, but keep them in same order, as we want to first resolve domain resolution query by caching-name server, so we will keep line first, in this file.


Note: I assume that your ISP's nameserver machine IP is


7.  Setting Up Host Name:

To set up your hostname according to your domain, we will edit /etc/sysconfig/network file, i.e.

$ vi /etc/sysconfig/network

Now type the following line:


8. Restarting BIND Daemon:

$ service named restart               (Redhat,Fedora,Centos)


$ /etc/rc.d/rc.bind restart            (Suse,Debian)


9. Testing:

Now to test whether your configuration is working fine or not, give the following command:

$ nslookup

If you get the following result, this means your BIND 9 is working fine: 



Now to test your caching-nameserver, give the following command:

$ nslookup

If you are getting the following result, this means the caching-nameserver is working fine.



Note: If you find any problem durring configuration, please feel free to contact me.

Share this page:

4 Comment(s)

Add comment


From: Nathan at: 2009-07-27 15:42:06

Seems like you're missing the step where you actually make the file . If you simply follow those directions you will not be able to start named. You will get an error similar to zone loading master file file not found.

Also the rpm command doesn't work on most linux distributions, only red hat based linux distributions, not debian/ubuntu/slackware/etc, etc.

From: at: 2007-02-04 00:11:02

should be

From: at: 2007-02-05 09:22:36


thanks for notifying , correction done.


From: at: 2007-02-14 17:51:30

I am running a system with FC6, with bind 9.3.4 and bind-chroot installed.

I found that I had to add my information for step 2 to /var/named/chroot/etc/named.conf .  (There was no /etc/named.conf.)

Once that was done, the rest went just as you described.  Thanks!