Ekaterina
Ekaterina

Reputation: 75

NXDOMAIN error with reverse DNS zone on Ubuntu 20.04

Good day! I have Ubuntu 20.04 and I wish to make local DNS server (on Core) in the following configuration: enter image description here

I used bind9. I made the forward zone with views and it seems that it works fine. Then I tried to make reverse zone and I have failed. I don't understand what is the problem. I read quite a lot of tutorials and watched numerous video. The content of configurations files are seemed to me ok. Please help me ))))

The content of the named.conf.local is the following: named.conf.local

The content of the named.conf.options is the following: named.conf.options

The content for reverse zone file in the following: reverse zone file

By the way I tried not to use ORIGIN the result is the same. The server doesn't see reverse zone at all. I have got NXDOMAIN error.

And the content of /etc/resolv.conf in the following: resolv.conf

Upvotes: -1

Views: 397

Answers (2)

Ekaterina
Ekaterina

Reputation: 75

The problem was obvious. IP addresse contains two parts: a network identifier and a host identifier. The network identifier is written in named.conf.local. And the host identifier is written in the file zone without any shortness. In my case I should write 16 digits in description of reverse zone in named.conf.local and 16 digits in file zone.

Upvotes: 0

grawity_u1686
grawity_u1686

Reputation: 16572

The server doesn't see reverse zone at all. I have got NXDOMAIN error.

That only means it didn't find the specific name – doesn't mean it doesn't see the entire zone.

One way to troubleshoot this is to 1) use tcpdump to capture the actual rDNS requests being made; 2) enable allow-transfer and use dig -t AXFR to check the contents of the zone as the server sees it; 3) compare the request from #1 against the transfer result you got from #2.

But the most likely problem is that the entries you have are too short for an IPv6 reverse zone. Right now you're defining rDNS for fd01:1 or something like that, not for fd01::1.

Even if you use IPv6 addresses in shortened form, the reverse zone needs to have the address in full – there is no way to express the :: in the rDNS format, so you need to expand the fd01::1 into fd01:0000:0000:0000:0000:0000:0000:0001, writing out each nibble, and then reverse that.

BIND's arpaname tool or Python's ipaddress can show you the full reverse name you need:

$ arpaname fd01::1
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.1.0.d.f.ip6.arpa

(...whereas, if you look at the zone through AXFR, it will likely show that your 1 IN PTR entry has only resulted in a 1.1.0.d.f.ip6.arpa.)

Because your zone has 1.0.d.f.ip6.arpa as its origin, this means you need a PTR for:

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 PTR core.adm.lab.
2.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 PTR srv-l.adm.lab.

Yes, managing IPv6 rDNS by hand gets annoying real quick.


I used to use this script to make rDNS zone generation a little more convenient:

#!/usr/bin/env python3
# mkreverse -- Transform shorthand like "[2001:db8::1] PTR foo.bar."
# into valid rDNS zone file entries.
#
#    $ mkreverse < rdns.zone.in > rdns.zone

import ipaddress
import sys
import time

print("; generated at", time.strftime("%F %T"))
for line in sys.stdin:
    if line.startswith("["):
        parv = line.strip().split()
        addr = ipaddress.ip_address(parv[0][1:-1])
        print("%s." % addr.reverse_pointer, *parv[1:])
    elif line.startswith("; ["):
        parv = line.strip().split()
        addr = ipaddress.ip_address(parv[1][1:-1])
        print("%s." % addr.reverse_pointer, "PTR", *parv[2:])
    else:
        line = line.replace("<serial>", time.strftime("%s"))
        print(line, end="")
print("; end")

Upvotes: 0

Related Questions