NSD is the NLnet Labs authoritative-only nameserver — deliberately minimal, deliberately fast. Where BIND tries to be everything and Knot adds online signing and modern policy, NSD does one thing: answer authoritative queries as fast as the kernel can hand it packets. This article is the install procedure on Ubuntu: package, config, zone file, transfers, and the nsd-control runtime CLI. The deliverable is a small, hardened authoritative server ready for traffic.
How to verify
Before installing, confirm port 53 is free and decide whether NSD will be the only authoritative on this host:
ss -lunp | grep ':53\b'
dpkg -l | grep -E 'nsd|bind9|knot|pdns-server'
systemctl status systemd-resolved
which nsd-control nsd-checkconf
NSD does not do recursion at all — if this host also needs to act as a recursor for clients, you need a second daemon on a different IP or port (Unbound is the natural pairing from the same vendor).
What’s happening
NSD (Name Server Daemon) is authoritative-only. It loads zone files into a compiled binary database (/var/lib/nsd/<zone>.db historically; modern versions hold them in memory after zone-compile), and answers from that. Reloads are atomic — NSD compiles the zone in a child process, then swaps in the new version without dropping queries. This makes NSD an excellent fit for zones that change rarely but must be answered for at top speed.
Operationally, NSD is opinionated:
- No recursion ever. If the network needs a recursor, run Unbound (sibling project) alongside.
nsd-controlfor runtime. Reload, transfer, zone-status — all through TLS-authenticated control channel. Set up keys withnsd-control-setupon first install.- DNSSEC signing is external. NSD will serve a pre-signed zone but does not sign on its own. The classic NLnet pattern is
ldns-signzoneordnssec-signzonein a cron job, thennsd-control reload. Modern setups often use OpenDNSSEC or a homegrown signing pipeline.
If you want online signing, Knot or PowerDNS are better fits. NSD is for static, pre-signed, very fast.
The procedure
-
Install the package. Ubuntu carries NSD in the main archive:
sudo apt update sudo apt install -y nsd sudo nsd-control-setup sudo systemctl status nsdnsd-control-setupgenerates the TLS key pair the daemon and the control client use to talk to each other. -
Configure the daemon. Edit
/etc/nsd/nsd.conf:server: ip-address: 127.0.0.1 ip-address: ::1 ip-address: 10.0.5.10 port: 53 server-count: 4 username: nsd chroot: "" logfile: /var/log/nsd.log hide-version: yes identity: "" zonesdir: /etc/nsd/zones remote-control: control-enable: yes control-interface: 127.0.0.1 control-port: 8952 key: name: "transfer-example" algorithm: hmac-sha256 secret: "BASE64-SECRET-HERE" pattern: name: "primary-zones" zonefile: "%s.zone" provide-xfr: 203.0.113.20 transfer-example notify: 203.0.113.20 transfer-example zone: name: "example.com" include-pattern: "primary-zones"chroot: ""keeps the daemon unchrooted, which is simpler operationally. If your security posture demands chroot, the path is/etc/nsdby default and you must adjustlogfileandzonesdiraccordingly. -
Drop the zone file.
/etc/nsd/zones/example.com.zone:$TTL 300 @ SOA ns1.example.com. hostmaster.example.com. ( 2026060201 3600 600 1209600 300 ) NS ns1.example.com. NS ns2.example.com. www A 203.0.113.10chown nsd:nsd /etc/nsd/zones/example.com.zone && chmod 0640keeps it tight. -
Validate and reload. NSD has a config checker:
sudo nsd-checkconf /etc/nsd/nsd.conf sudo systemctl restart nsd sudo nsd-control status sudo nsd-control zonestatus example.com -
Verify queries. From the host and from outside:
dig @127.0.0.1 example.com SOA +norec dig @10.0.5.10 www.example.com A +norec +short -
Trigger an outbound transfer. If this NSD is a primary and you have a secondary configured to receive AXFR, bump the SOA serial in the zone file and reload:
sudo vi /etc/nsd/zones/example.com.zone # bump serial sudo nsd-control reload example.com sudo nsd-control notify example.comnsd-control notifyre-sends NOTIFY to the configured peers — useful if the previous NOTIFY was lost.
Common pitfalls
identity: ""andhide-version: yesare not the default. Out of the box NSD will tell anyone who asks what version it is and achaosquery reveals the server name. Set both explicitly.- Signed zones requiring reload after re-sign. If your signing pipeline writes a new signed zone file, NSD does not pick it up automatically. The pipeline must run
nsd-control reload <zone>after every signing cycle. server-counthigher than CPU cores. NSD spawnsserver-countworker processes. Setting it higher than physical cores just adds context switching with no throughput gain. Match it to physical cores, not threads.- NSEC3-signed zones and the
nsd-controlzonestatus output. A zone is “ok” even if the signing horizon is hours from expiry —nsd-controldoes not monitor RRSIG expiry. Add a separate check for “earliest RRSIG inception/expiry within zone” in monitoring. - AXFR-only secondaries on slow links. A large zone over a slow link can hit the AXFR timeout. Bump
xfrd-tcp-timeoutif zone transfers are timing out, but the better answer is IXFR for incremental updates.
In the engagements we run, NSD shows up where the zones are static or change rarely and the QPS is high — anycast edges, frequently-queried but rarely-edited zones, ccTLD-style workloads. We pair it with Unbound for the resolver role, codify the pre-signing pipeline, and treat the NSD config as part of the same change cycle. See our managed operations service for the broader operating model.