Ubuntu – Bind9 DNS reverse lookup fail

binddomain-name-systemUbuntu

Okay so I got a problem, that my reverse lookup fail on my bind9 dns

#nslookup 172.16.0.179
Server:     127.0.1.1
Address:    127.0.1.1#53

** server can't find 179.0.16.172.in-addr.arpa: NXDOMAIN

Here is my reverse zone:

# nano /var/lib/bind/mosek.intranet.rev.zone

$ORIGIN .
$TTL 604800     ; 1 week
172.16.0.in-addr.arpa   IN SOA  braintree.mosek.intranet. admin.mosek.com. (
                            79         ; serial
                            604800     ; refresh (1 week)
                            86400      ; retry (1 day)
                            2419200    ; expire (4 weeks)
                            604800     ; minimum (1 week)
                            )
                    NS      braintree.mosek.intranet.
$ORIGIN 0.16.172.172.16.0.in-addr.arpa.
$TTL 3600       ; 1 hour
179                     PTR     harbinger.mosek.intranet.

The PTR entry is something bind9 autogenerated

and here is my /etc/bind/named.conf.local

//
// Do any local configuration here
//
include "/etc/bind/rndc.key";

zone "mosek.intranet" {
        type master;
        file "/var/lib/bind/mosek.intranet.zone";
        allow-update {key rndc-key; };
};

zone "172.16.0.in-addr.arpa"{
        type master;
        file "/var/lib/bind/mosek.intranet.rev.zone";
        allow-update {key rndc-key; };
};


// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

as I see it, everything looks fine. what could cause the problem?

EDIT

I got it working so here's the working config:

# cat /etc/bind/named.conf.local
//
// Do any local configuration here
//
include "/etc/bind/rndc.key";

zone "mosek.intranet" {
        type master;
        file "/var/lib/bind/mosek.intranet.zone";
        allow-update {key rndc-key; };
};

zone "0.16.172.in-addr.arpa"{
        type master;
        file "/var/lib/bind/mosek.intranet.rev.zone";
        allow-update {key rndc-key; };
};


// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";

.

# cat /var/lib/bind/mosek.intranet.rev.zone
$ORIGIN .
$TTL 604800     ; 1 week
0.16.172.in-addr.arpa   IN SOA  braintree.mosek.intranet. admin.mosek.com. (
                                79         ; serial
                                604800     ; refresh (1 week)
                                86400      ; retry (1 day)
                                2419200    ; expire (4 weeks)
                                604800     ; minimum (1 week)
                                )
                                NS      braintree.mosek.intranet.              $
$ORIGIN 0.16.172.in-addr.arpa.
$TTL 604800     ; 1 week
179                     PTR     harbinger.mosek.intranet.

Best Answer

When specifying PTR records using the in-addr.arpa domain, the least significant part of the network IP address should come before the remaining parts, i.e., the reverse of the usual way of specifying IP addresses in dot-decimal notation.

From Wikipedia article on Reverse DNS lookups

Reverse DNS lookups for IPv4 addresses use a reverse IN-ADDR entry in the special domain in-addr.arpa. In this domain, an IPv4 address is represented as a concatenated sequence of four decimal numbers, separated by dots, to which is appended the second level domain suffix .in-addr.arpa. The four decimal numbers are obtained by splitting the 32-bit IPv4 address into four 8-bit portions and converting each 8-bit portion into a decimal number. These decimal numbers are then concatenated in the order: least significant 8-bit portion first (leftmost), most significant 8-bit portion last (rightmost). It is important to note that this is the reverse order to the usual dotted-decimal convention for writing IPv4 addresses in textual form.

In your case, 172.16.0.in-addr.arpa should be re-written in all your BIND configuration files as 0.16.172.in-addr.arpa. E.g., here’s how the zone file should look:

$ORIGIN .
$TTL 604800     ; 1 week
0.16.172.in-addr.arpa IN SOA  braintree.mosek.intranet. admin.mosek.com. (
                            79         ; serial
                            604800     ; refresh (1 week)
                            86400      ; retry (1 day)
                            2419200    ; expire (4 weeks)
                            604800     ; minimum (1 week)
                            )
                    NS      braintree.mosek.intranet.
$ORIGIN 0.16.172.in-addr.arpa
$TTL 3600       ; 1 hour
179                     PTR     harbinger.mosek.intranet