How-tos  Scripts  Pricing  Testimonials  Support  Newsletter

Tested on OpenBSD 6.4

Configure nsd(8) on OpenBSD

Install two VMs in two different networks.
For example, OpenBSD.Amsterdam and Vultr.

Let’s pick arbitrary names for them:

ns1.example.com
ns2.example.com

Edit nsd.conf(5) on ns1,
create a zone file for example.com,
copy nsd.conf and example.com.zone to ns2,
enable and start nsd(8) on both servers.

# cat > /var/nsd/etc/nsd.conf << EOF
server:
  database: ""

remote-control:
  control-enable: yes
  control-interface: /var/run/nsd.sock

zone:
  name: example.com
  zonefile: master/%s.zone
EOF
#
# cat > /var/nsd/zones/master/example.com.zone << EOF
$ORIGIN             example.com.
$TTL    300
@       3600  SOA   ns1.example.com. hostmaster.example.com. (
        2018121401  ; serial YYYYMMDDnn
        1440        ; refresh
        3600        ; retry
        604800      ; expire
        300 )       ; minimum TTL
@             NS    ns1.example.com.
@             NS    ns2.example.com.
ns1           A     46.23.88.178
ns2           A     140.82.28.210
@             MX    10 smtp.example.com.
@             MX    20 smtp.example.com.
@             A     46.23.88.178
www           A     46.23.88.178
EOF
#
# rcctl enable nsd
# rcctl start nsd
nsd (ok)
# dig +short example.com NS @127.0.0.1
ns1.example.com.
ns2.example.com.
#

Update nameservers ns1.example.com and their IP addreses (for glue records) at your domain registrar. Your mail server should accept mail for hostmaster@example.com.

Verify your setup with zonemaster.net.

Update zone

Edit the zone file and increment the serial on ns1, copy the zone file to ns2, reload nsd(8) on ns1 and ns2.

# rcctl reload nsd
nsd(ok)
#

© 2008–2019 Roman Zolotarev  User Agreement  Privacy Policy