Configuring rDNS using NSD

We can configure our rDNS using nsd, an authoritative name server. nsd comes as part of openbsd base so no installation will be necessary.

NOTICE: This guide assumes you have already configured nsd for forward DNS resolution.

IPv6 Subnet

Suppose we have been delegated the rDNS zone for our IPv6 subnet, 2001:550:3402:1:143::/80. To find out our zone, we need to fill in all the missing zeros, put periods between each digit, reverse the digits, then add

2001:550:3402:1:143:: # original subnet
2001:0550:3402:0001:0143:: # fill in the missing zeros # add periods between each digit # reverse the digits # add

Here is a simple command to do this:

echo "<IPv6 subnet>"|rev|sed "s/://g;s/\(.\)/\1./g;s/$/"

Replace <IPv6 subnet> with your real IPv6 subnet. Make sure to fill in any missing zeros.

For example:

echo "2001:0550:3402:0001"|rev|sed "s/://g;s/\(.\)/\1./g;s/$/"

Zone File

Now we must create the zone file in /var/nsd/zones/master/

@       3600    IN      SOA (
                2021020105 1800 3600 1209600 3600 )
        3600    IN      NS
        3600    IN      NS         3600    IN      PTR         3600    IN      PTR


Now we only need to add this section to /var/nsd/etc/nsd.conf:

        name: ""
        zonefile: "master/"

Restart nsd and test

$ doas rcctl restart nsd

We can test using host? or dig:

host 2001:550:3402:1:143::1 <nameserver-ip>

Replace <nameserver-ip> with your actual nameserver IP. Once you have confirmed this is working, you can then ask to have your zone delegated to your nameserver.

You can then test if both forward and reverse DNS lookup work by using netcat to connect to IRC.