Linux- How to‎ > ‎

Ch 19 DNS (BIND)

IP to host and host to IP resolve..


  .com   – commercial

  .org   – organization

  .mel   – meltem – India (only)

  .gov   - government

  .travel – Travel Domain


 Packages required for BIND

   #rpm –qa |grep bind

      bind                2nd C.D

      bind-chroot         2nd C.D

      bind-devels         3rd C.D

      bind-utils          3rd C.D

      Caching-name server 4th C.D


  # cd /var/named/chroot/etc

  # Create named.conf (using 2 files)

  # vi named.conf

  # vi named.caching.servername.conf

   till allow.query ( 11 Lines copy to named.conf)

  # vi named.rfc.1912.zones

    from Zone “.” IN

   to Zone

   Copy that lines & append in  named.conf.


We can use cat >>  command to do above copy and paste job..



   # cd /var/named/chroot/var/named.    ----> forward

    Named.local   ----> Reserve

  # cp  domain.fzone

  # cp named.local  domain.rzone


                           DNS Theory


      In networking including the internet user locate other computers by name. This frees users from the task of remember numeric

Address of net resources.


    The most effective way to configure the network to allow such name base connection is to setup Domain name service or a name server

Which resolve hostname on the network in to numerical address and vise versa.

        DNS associate host name with their respective IP address so that when user want to connect to other machine on the network they can refer to them by name without having to remember IP address.

  DNS is normally implement using centralize servers that are authoritative for some Domains and refer to other DNS server to other domains.

     When a client host request information from a Name server it usually connect to port 53 the name server then attempts to resolve the FQDN ( fully qualified domain name) best on its resolve library which may contain authoritative information about the host. Requested or cache data from an earlier query IF the Name server doesn’t already have the answer in its resolve library its query other name server to determine which name server are authority for the FQDN with information its query autho. Name server to determine the IP address of the requested host.

    IF reveres Lookup Zone perform the same process is used. A scope that query is made with an unknown IP address return then name.


  The FQDN of host can be bracken into different segment this segment

Are Organized into hierarchy (like tree) with a main trunk , primary

Branches and e.g.

   When looking FQDN resolve to find the IP addresses to reflect particular system read the name right to left which is level of hierarchy divided by period (.) in this example  first top level domain for this FQDN.


  The name neil is some domain under com while swappy sub domain under neil the name stn3 identifying a specific machine hostname.

Where are zone file, zone file stored in primary name server also called master name server with are truly authority and where change

are to file and secondary name server also called slave name server which received their zone file from primary name server.



Forward lookup zone

Reverse lookup zone


slave server


    *) master name server type master store organize and authoritative zone record for name space and answer query about the name space from other name server.


    *) slave server

       answer query from their name server concerning name species for which it is consider as authority however slave name server get their name space.

                    Package require    



caching-name server

files :

   # /var/named/chroot/etc/name.conf

   # /var/named/chroot/var/named/

  # vi

  # vi named.local

  # vi /etc/resolve.conf

  # vi /etc/hosts

  # rpm –qa |grep bind

 # yum install bind*

 #rpm –qa |grep caching

 #yum install caching*

 #cd /var/named/chroot/etc

 #vi named.rfc1912.zones

 # cp named.rfc1912.zones named.conf

 # vi named.conf

 # vi named.caching-nameserver.conf


Copy options{


paste in (named.conf) named.conf at starting  of file.



 Options {

            Listen –on port 53{};

  #vi named.conf

   copy zone line 11 line and paste below zone file above IPv6 line.

   Zone “



Zone “” In {

      Type master;




  Zone “”In{

   (reveres ip decided on class I.E a b c)

     type master;

     file “lion.rzone”;

     allow-update {none;};



         listen on port 53 {}

           allow-query {;};

     #chown named named.conf

     #cd /var/named/chroot/var/named

     # cp line.fzone

     # cp named.local line.rzone

     #chown named lion.fzone

     #chown named lion.rzone

     #vi lion.fzone


 # IN ------> internet name

 # SOA -----> start of authority

 # A -------> Address

 # NS ------> Name server

 # PTR -----> Pointer record

 # $TTL ----> Time to leave

$TTL 86400

      In SOA (

      IN  NS

      IN  A

      IN  AAAA  ::1

Stn3  IN  A

www   IN  A


  # vi lion.rzone

  $TTL 86400

  @ In SOA (       

 # “3” why three? System ip for Class B use last octet)

    IN  NS

3   IN  PTR

3   IN  PTR  www.



#vi /etc/resove.conf



#vi /etc/hosts stn3

# service named restart

# nslookup

# nslookup

# nslookup

DIG  ( domain information groper)  

# dig

# dig –x

                    Slave Server

   Same step to install slave server as master server.

  # vi named.conf

  Zone “” In {

      Type slave;


      File “slaves/lion.fzone”;



  Zone “” IN {

    (reveres ip decided on class I.E a b c)

      type slave;

     file “lion.rzone”;


    File “slaves/lion.rzone”;


  # chown named named.conf

  #vi /etc/resove.conf




 # service named restart

 # cd /var/named/chroot/var/named

 #cd slaves

Both file added automatically from master server after service restart.