Setup Master-Slave DNS Server Using “Bind” Tools in RHEL/CentOS 6.5

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Babin Lonston

I'm Working as a System Administrator for last 10 year's with 4 years experience with Linux Distributions, fall in love with text based operating systems.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

71 Responses

  1. Krishna says:

    if suddenly primary DNS fails what will happen?
    can you please explain the other dns zones like stub zone
    can we configure the stubzone in linux

  2. Husain says:

    Hi Ravi,

    Thanks! for such a informative article. I actually When i am checking reverse lookup zone file. i am getting below error …could you please help me out.

    [root@vxvm1 ~]# named-checkzone vxvm1.husain.net /var/named/husain.rev.zone
    

    zone vxvm1.husain.net/IN: NS ‘vxvm1.husain.net’ has no address records (A or AAAA)
    zone vxvm1.husain.net/IN: not loaded due to errors.

    • @Husain,

      Provide us you configuration in any pastebin or screenshot.

      • Husain says:

        1 $TTL 86400
        2 @ IN SOA vxvm1.husain.net. root.husain.net. (
        3 2014090402 ; serial
        4 3600 ; refresh
        5 1800 ; retry
        6 604800 ; expire
        7 86400 ) ; minimum
        8 ; Name server’s
        9
        10 @ IN NS vxvm1.husain.net.
        11 @ IN NS rhel7.husain.net.
        12 @ IN PTR husain.net.
        13 ; Name server hostname to IP resolve.
        14
        15 vxvm1 IN A 10.10.104.20
        16 rhel7 IN A 10.10.104.115
        17
        18 ;Hosts in Domain
        19 vxvm2 IN A 10.10.104.30
        20 sarvar IN A 10.10.104.111
        21 111 IN PTR sarvar.husain.net.
        22 30 IN PTR vxvm2.husain.net.

  3. raaz says:

    1 $TTL 86400
    2 @ IN SOA ns1.mailninja.io. root.mailninja.io. (
    3 2016090101 ; serial
    4 3600 ; refresh
    5 1800 ; retry
    6 604800 ; expire
    7 86400 ) ; minimum
    8 @ IN NS ns1.mailninja.io.
    9 @ IN NS ns2.mailninja.io.
    10 @ IN PTR mailninja.io.
    11 ns1 IN A 192.168.1.126
    12 ns2 IN A 192.168.1.121
    13 ;Hosts in domain
    14 126 IN PTR ns1.mailninja.io.
    15 121 IN PTR ns2.mailninja.io.

    named-checkzone ns1.mailninja.io /var/named/mailninja.rev.zone
    zone ns1.mailninja.io/IN: NS ‘ns1.mailninja.io’ has no address records (A or AAAA)
    zone ns1.mailninja.io/IN: not loaded due to errors.

    Hi ravi can you plz ellaborate what did i miss here that i am getting errors for reverse zone file.

  4. raaz says:

    named-checkzone ns1.mailninja.io /var/named/mailninja.rev.zone
    zone ns1.mailninja.io/IN: NS ‘ns1.mailninja.io’ has no address records (A or AAAA)
    zone ns1.mailninja.io/IN: not loaded due to errors.

    cat -n 1 $TTL 86400
    2 @ IN SOA ns1.mailninja.io. root.mailninja.io. (
    3 2016090101 ; serial
    4 3600 ; refresh
    5 1800 ; retry
    6 604800 ; expire
    7 86400 ) ; minimum
    8 @ IN NS ns1.mailninja.io.
    9 @ IN NS ns2.mailninja.io.
    10 @ IN PTR mailninja.io.
    11 ns1 IN A 64.137.226.126
    12 ns2 IN A 64.137.167.121
    13 ;Hosts in domain
    14 126 IN PTR ns1.mailninja.io.
    15 121 IN PTR ns2.mailninja.io.

  5. vishant says:

    Starting named:
    Error in named configuration:
    dns_rdata_fromtext: forward:8: near ‘epsilon.jhilmil.com’: extra input text
    zone jhilmil.com/IN: loading from master file forward failed: extra input text
    zone jhilmil.com/IN: not loaded due to errors.
    _default/jhilmil.com/IN: extra input text
    zone localhost/IN: loaded serial 0
    zone 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 0
    dns_rdata_fromtext: reverse:8: near ‘epsilon.jhilmil.com’: extra input text
    zone 211.168.192.in-addr.arpa/IN: loading from master file reverse failed: extra input text
    zone 211.168.192.in-addr.arpa/IN: not loaded due to errors.
    _default/211.168.192.in-addr.arpa/IN: extra input text
    zone 0.in-addr.arpa/IN: loaded serial 0

    getting this error when starting dns service
    help me out.

  6. Mallikarjunn says:

    Hello Ravi,

    FOR example I have typed dig facebook.com, ok.

    It gives me some dns detials,

    Queston: for ex : I don’t have facebook nameserver address in my local sysem /etc/resolv.conf,?

    so how it gives me the some dns result.

    and

    one more question is very simple.

    I have made one dns server how it goes to public they don’t have my dns server details. how they can see?

    Please clarify my doughts as soon as possible.

    • Aaron Kili K says:

      @Mallikarjunn

      First question:

      When your machine(client) is connected to the Internet through an ISP, it initiates a query to find facebook.com and sends the query to the DNS server of the ISP.

      Then, the DNS Server of the ISP first checks it’s own cache to determine if it already has a result for your machine’s query.

      In the event that the result is negative(meaning nothing found), it generates another query, sends it to a hierarchy above it. Your machine’s query will keep moving up the up until it reaches the root DNS servers, and until when facebook.com is found.

      After the ISP DNS Server finding out the authoritative name servers, it contacts the authoritative name servers to find out the IP address for http://www.facebook.com. i.e. the IP address of host www in the domain facebook.com.

      facebook.com then responds to the ISP DNS Server by answering the query and providing the IP address of the web server i.e. www

      The ISP DNS Server stores the answer in it’s cache for any future use and provides the result to your machine(client) by sending the IP address of the www server plus so many other details.

      Second question:

      All the magic happens through your ISP, when your are connected to the Internet, the ISP must gather information about your network setup including the DNS server setup. Then other networks can find your DNS server through your ISP servers(network).

  7. Mallikarjunn says:

    hi, ravi,

    I don’t understand, how dns works What you have disscussed somewhat tough to understand.

    Please explain in one sentence

    • Ravi Saive says:

      @Mallik,

      We’ve tried and kept the information as simple as it, but I am afraid that you still finding it tough to understand, no problem here is the screencast that tells how exactly dns works, just go through it: https://howdns.works/

  8. arun natarajan says:

    hi babin,

    your post looks great with clear explanation and with color highlights.

    when am configure only master DNS in my machine, facing issue with rev.zone file.

    named.conf testing went fine
    fwd.zone testing went fine.
    rev.zone testing ended with following error.

    [root@server ~]# named-checkzone server.example.com /var/named/example.rev.zone
    zone server.example.com/IN: NS ‘server.example.com’ has no address records (A or AAAA)
    zone server.example.com/IN: not loaded due to errors.
    [root@server ~]#

    this is my rev zone file.

    [root@server ~]# cat /var/named/example.rev.zone
    $TTL 86400
    @ IN SOA server.example.com. root.example.com. (
    0 ; serial
    1D ; refresh
    1H ; retry
    1W ; expire
    3H ) ; minimum
    ;name servers

    @ IN NS server.example.com.
    @ IN PTR example.com.

    ;name server hostname to ip resolver

    server IN A 192.168.1.1
    1 IN PTR server.example.com.

    • Ravi Saive says:

      @Arun,

      I think you should add ‘A’ record pointing to IP address like:

      servername     IN   A       ipaddress
      
      • arun natarajan says:

        that entry is already there ravi…

        FYR

        [root@server named]# cat -n example.rev.zone
        1 $TTL 86400
        2 @ IN SOA server.example.com. root.example.com. (
        3 200102 ; serial
        4 3600 ; refresh
        5 1800 ; retry
        6 604800 ; expire
        7 86400 ; minimum )
        8 ;name servers
        9
        10 @ IN NS server.example.com.
        11 @ IN PTR example.com.
        12
        13 ;name server hostname to ip resolver
        14
        15 server IN A 192.168.1.1
        16 1 IN PTR server.example.com.
        17

      • arun natarajan says:

        hi ravi,

        i got the o/p now. thanks for your help and time.

        all verification cmds are giving o/ps expect from below….when diagnosing with ip address

        [root@server etc]# dig -x 192.168.1.1

        ; <> DiG 9.7.0-P2-RedHat-9.7.0-5.P2.el6 <> -x 192.168.1.1
        ;; global options: +cmd
        ;; Got answer:
        ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 48244
        ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
        ;; WARNING: recursion requested but not available

        ;; QUESTION SECTION:
        ;1.1.168.192.in-addr.arpa. IN PTR

        ;; Query time: 0 msec
        ;; SERVER: 192.168.1.1#53(192.168.1.1)
        ;; WHEN: Thu May 26 22:21:38 2016
        ;; MSG SIZE rcvd: 42

        [root@server etc]#

  9. shasha says:

    Error: bind97-libs conflicts with bind-libs
    Error: bind97-devel conflicts with bind-libbind-devel
    Error: bind97-chroot conflicts with bind-chroot
    Error: bind97-utils conflicts with bind-utils
    Error: bind97 conflicts with bind
    Error: bind97-devel conflicts with bind-devel

    How to resolve it this error

  10. krishna says:

    THANKS FOR YOUR QUICK RESPONSE, but my question is why we have to write A records in reverse lookup zone
    node1 IN A 192.168.0.210
    rhel IN A 192.168.0.220
    in reverse lookup zone

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 202,035
  2. 9,267
  3. 38,621

Are you subscribed?