DNS configuration problem with BIND9

8,712

The IPs for files "home.lan.db" and "rev.1.168.192.in-addr.arpa" don't match. Just correct them.

/etc/bind/zones/home.lan.db

; Set the hostnames in alphabetical order
home         IN A 192.168.1.7
ntinstall    IN A 192.168.1.7
kalu         IN A 192.168.1.7
router       IN A 192.168.1.1
server       IN A 192.168.1.5


/etc/bind/zones/rev.1.168.192.in-addr.arpa

; our hosts, in numeric order
1         IN PTR router.home.lan.
2         IN PTR ubuntu.home.lan.
3         IN PTR ntinstall.home.lan.
4         IN PTR kalu.home.lan.

############

# For example, the correct one should be:
/etc/bind/zones/home.lan.db

; Set the hostnames in alphabetical order
kalu         IN A 192.168.1.4
ntinstall    IN A 192.168.1.3
router       IN A 192.168.1.1
ubuntu       IN A 192.168.1.2


/etc/bind/zones/rev.1.168.192.in-addr.arpa

; our hosts, in numeric order
1         IN PTR router.home.lan.
2         IN PTR ubuntu.home.lan.
3         IN PTR ntinstall.home.lan.
4         IN PTR kalu.home.lan.
Share:
8,712

Related videos on Youtube

Registered User
Author by

Registered User

Updated on September 18, 2022

Comments

  • Registered User
    Registered User over 1 year

    Following is my BIND9 configuration. The domain I want to configure is home.lan. It is the home network.

    /etc/bind/named.conf.local is:

    zone "home.lan" IN {
        type master;
        file "/etc/bind/zones/home.lan.db";
    };
    zone "1.168.192.in-addr.arpa" {
        type master;
        file "/etc/bind/zones/rev.1.168.192.in-addr.arpa";
    };
    

    /etc/bind/named.conf.options is:

    options {
            directory "/var/cache/bind";
    
            // If there is a firewall between you and nameservers you want
            // to talk to, you may need to fix the firewall to allow multiple
            // ports to talk.  See http://www.kb.cert.org/vuls/id/800113
    
            // If your ISP provided one or more IP addresses for stable
            // nameservers, you probably want to use them as forwarders.
            // Uncomment the following block, and insert the addresses replacing
            // the all-0's placeholder.
    
            // forwarders {
            //      0.0.0.0;
            // };
    
            //========================================================================
            // If BIND logs error messages about the root key being expired,
            // you will need to update your keys.  See https://www.isc.org/bind-keys
            //========================================================================
            dnssec-validation auto;
    
            auth-nxdomain no;    # conform to RFC1035
            listen-on-v6 { any; };
    };
    

    Since it is a personal network, I do not need any forwarders section,so did not configure it.

    /etc/bind/zones/home.lan.db

    ; Use semicolons to add comments.
    ; Host-to-IP Address DNS Pointers for home.lan
    ; Note: The extra “.” at the end of the domain names are important.
    
    ; The following parameters set when DNS records will expire, etc.
    ; Importantly, the serial number must always be iterated upward to prevent
    ; undesirable consequences. A good format to use is YYYYMMDDII where
    ; the II index is in case you make more that one change in the same day.
    $ORIGIN .
    $TTL 86400      ; 1 day
    home.lan. IN SOA ubuntu.home.lan. hostmaster.home.lan. kalu.home.lan. (
        2008080901 ; serial
        8H ; refresh
        4H ; retry
        4W ; expire
        1D ; minimum
    )
    
    ; NS indicates that ubuntu is the name server on home.lan
    ; MX indicates that ubuntu is (also) the mail server on home.lan
    home.lan. IN NS kalu.home.lan.
    home.lan. IN MX 10 ubuntu.home.lan.
    
    $ORIGIN home.lan.
    
    ; Set the address for localhost.home.lan
    localhost    IN A 127.0.0.1
    
    ; Set the hostnames in alphabetical order
    home         IN A 192.168.1.7
    ntinstall    IN A 192.168.1.7
    kalu         IN A 192.168.1.7
    router       IN A 192.168.1.1
    server       IN A 192.168.1.5
    

    and /etc/bind/zones/rev.1.168.192.in-addr.arpa:

    ; IP Address-to-Host DNS Pointers for the 192.168.1 subnet
    @ IN SOA ubuntu.home.lan. hostmaster.home.lan. (
        2008080901 ; serial
        8H ; refresh
        4H ; retry
        4W ; expire
        1D ; minimum
    )
    ; define the authoritative name server
               IN NS ubuntu.home.lan.
    ; our hosts, in numeric order
    1         IN PTR router.home.lan.
    2         IN PTR ubuntu.home.lan.
    3         IN PTR ntinstall.home.lan.
    4         IN PTR kalu.home.lan.
    

    /etc/hostnames:

    kalu
    

    The /etc/resolv.conf on the BIND9 server is:

    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.0.1
    search home.lan
    
    
    at the client machine
    /etc/resolv.conf
    
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.0.1
    nameserver 192.168.1.7
    search home.lan
    

    From client machine when I try to ping I get the following results:

    $ ping kalu.home.lan
    ping: unknown host kalu.home.lan
    

    There is no file like /var/log/bind.log So I amnot sure where to look for it.

    Here is dig output at server:

    dig kalu.home.lan

    ; <<>> DiG 9.8.1-P1 <<>> kalu.home.lan
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 36937
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;kalu.home.lan.         IN  A
    
    ;; Query time: 0 msec
    ;; SERVER: 127.0.0.1#53(127.0.0.1)
    ;; WHEN: Fri Oct 11 23:59:03 2013
    ;; MSG SIZE  rcvd: 31
    

    At the client machine dig kalu.home.lan gives the following results:

     dig kalu.home.lan
    
    ; <<>> DiG 9.8.1-P1 <<>> kalu.home.lan
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 25537
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;kalu.home.lan.         IN  A
    
    ;; AUTHORITY SECTION:
    .           7388    IN  SOA a.root-servers.net. nstld.verisign-grs.com. 2013101101 1800 900 604800 86400
    
    ;; Query time: 43 msec
    ;; SERVER: 127.0.0.1#53(127.0.0.1)
    ;; WHEN: Fri Oct 11 23:59:34 2013
    ;; MSG SIZE  rcvd: 106
    

    What is the mistake in above DNS configuration? kalu is the hostname of machine on which I am configuring all this.

    To enable logging in BIND9 rndc querylog it shows:

    Oct 12 01:42:16 ubuntu named[11408]: dns_rdata_fromtext: /etc/bind/zones/home.lan.db:11: near 'kalu.home.lan.': not a valid number
    Oct 12 01:42:16 ubuntu named[11408]: zone home.lan/IN: loading from master file /etc/bind/zones/home.lan.db failed: not a valid number
    Oct 12 01:42:16 ubuntu named[11408]: zone home.lan/IN: not loaded due to errors.
    Oct 12 01:42:16 ubuntu named[11408]: zone localhost/IN: loaded serial 2
    Oct 12 01:42:16 ubuntu named[11408]: managed-keys-zone ./IN: loaded serial 5
    

    and I see:

     sudo named-checkzone home.lan home.lan.db
    [sudo] password for hp: 
    zone home.lan/IN: loading from master file home.lan.db failed: file not found
    zone home.lan/IN: not loaded due to errors.
    
    • BlitZz
      BlitZz over 10 years
      what does dig kalu.home.lan respond? did you check the logfiles to ensure bind loaded the zone files correctly?
    • Registered User
      Registered User over 10 years
      I updated the answer but surprisingly there is no file /var/log/bind.log