nsd.conf
NSD configuration file format and optionsSynopsis
Description
This file is used to configure nsd(8). It specifies options for the NSD server, zone files, primaries and secondaries.File Format
The file format has attributes and values. Some attributes have attributes inside them. The notation is:- Comments start with
#and last to the end of line - Empty lines are ignored, as is whitespace at the beginning of a line
- Quotes must be used for values with spaces in them, e.g.,
"file name.zone" - There must be whitespace between keywords
- Attribute keywords end with a colon
:
Example
A short example configuration:Top-Level Clauses
At the top level, only these clauses are allowed:server:- Global server optionsverify:- Zone verification optionskey:- TSIG key definitionspattern:- Zone option patternszone:- Zone configurationstls-auth:- TLS authentication for XFR-over-TLSremote-control:- Remote control optionsinclude:- Include external files
Include Directive
Files can be included using theinclude: directive:
*, ?, {}, [], and ~ (see glob(7)).
Server Options
Theserver: clause contains global server options. There may only be one server: clause.
Bind to the specified IP address (IPv4, IPv6, or interface name). Can be given multiple times. Optionally include a port number with Additional options:
@port.servers, bindtodevice, setfibSame as
ip-address (for compatibility with unbound.conf).Allows NSD to bind to non-local addresses. Useful to have NSD listen to IP addresses that are not yet added to the network interface.
Set the IP_FREEBIND option to bind to nonlocal addresses and interfaces that are down. Similar to
ip-transparent.Use the SO_REUSEPORT socket option. Improves performance when combined with
server-count > 1. Works on Linux.Set the send buffer size for query-servicing sockets in bytes. Set to 0 to use system defaults. Default is 4m.
Set the receive buffer size for query-servicing sockets in bytes. Set to 0 to use system defaults. Default is 1m.
Do not fork a daemon process. Same as command-line option
-d.Enable or disable IPv4 connections.
Enable or disable IPv6 connections.
This option is ignored by NSD versions 4.8.0 and newer (database feature removed).
File used to store the dynamically added list of zones. Used by
nsd-control addzone and delzone commands.Returns the specified identity when asked for
CH TXT ID.SERVER. Default is the name from gethostname(3). Same as -i.Returns the specified version string when asked for
CH TXT version.server or version.bind queries.Add the specified NSID to the EDNS section of the answer when queried with NSID EDNS enabled. Hex string or
ascii_ prefix. Same as -I.Log messages to the specified file. Default is to log to stderr and syslog. Same as
-l.Log messages only to syslog. Useful with systemd to avoid duplicate log strings in journald.
Start this many NSD server processes. Same as
-N.Overall CPU affinity for NSD servers. Specify core numbers.
Bind NSD server N to a specific core. Only takes effect if
cpu-affinity is enabled.Bind xfrd process to a specific core. Only takes effect if
cpu-affinity is enabled.Maximum number of concurrent, active TCP connections per server. Same as
-n.Drop TCP connections beyond
tcp-count immediately (accept and close).Maximum number of queries served on a single TCP connection. 0 means unlimited.
TCP timeout in seconds. Also affects zone transfers over TCP.
Maximum segment size (MSS) of TCP socket. Values lower than common MSS (e.g., 1220) address path MTU problems.
Maximum segment size (MSS) of TCP socket for outgoing XFR requests.
Set the TCP backlog for listening sockets. Default -1 selects the largest allowed value.
Number of sockets for xfrd to use for outgoing zone transfers.
Number of simultaneous outgoing zone transfers possible on xfrd TCP sockets. Max 65536.
Preferred EDNS buffer size for IPv4.
Preferred EDNS buffer size for IPv6.
Use the specified PID file. Use
"" for no pidfile. Same as -P.Answer queries on the specified port. Same as
-p.Produce statistics every N seconds. Same as
-s.Chroot on startup to the specified directory. Use
"" to disable. Same as -t.Drop privileges to this username after binding. Can be
username, id, or id.gid. Same as -u.Change working directory to this location before accessing zone files.
Ignored (for NSD3 compatibility).
File to save zone transfer daemon state. Use
"" to disable.Directory where zone transfers are stored before processing.
Wait this many seconds before triggering reload after zone transfer. -1 disables automatic reload.
Verbosity level for logging. Same as
-V.- 0: Warnings and errors
- 1: Notifies and zone transfers
- 2: Soft errors like connection resets
Prevent NSD from replying with version string on CHAOS class queries.
Prevent NSD from replying with identity string on CHAOS class queries.
Drop received packets with the UPDATE opcode.
Log time in ASCII format (not seconds since epoch).
Log time in ISO8601 format (requires
log-time-ascii: yes).Enable round-robin rotation of records in answers for load balancing.
Enable minimal responses for smaller answer packets.
Don’t add additional information if the apex zone doesn’t match the initial query.
Refuse queries of type ANY. Useful to stop query floods.
Reload configuration file on SIGHUP and update TSIG keys and zones.
Check mtime of zone files on start and SIGHUP.
Write updated secondary zones to disk every N seconds.
Rate Limiting Options
Size of the RRL hashtable in buckets. More buckets use more memory and reduce collisions.
Maximum queries per second allowed from one source. 0 disables rate limiting.
Send a truncated response for 1 in N dropped responses. 0 disables SLIP responses.
IPv4 prefix length for grouping addresses by netblock.
IPv6 prefix length for grouping addresses by netblock.
Maximum QPS for whitelisted query types. 0 means unlimited.
DNS Cookies
Enable DNS Cookies (RFC 7873). Provides limited protection against DoS amplification attacks.
128-bit hex string for creating and verifying server cookies.
128-bit hex string for verifying (not creating) server cookies. For rolling secrets in anycast.
File from which cookie secrets are read. Manipulated with
nsd-control commands.TLS Options
Private key file for TLS service. Enables DNS-over-TLS.
Public certificate PEM file for TLS service.
OCSP PEM file for TLS service OCSP stapling.
Port number for DNS-over-TLS service.
Port number for authenticated TLS (mutual TLS for XFR-over-TLS).
Allow zone transfers only on
tls-auth-port and only to authenticated clients.Certificate bundle file for authenticating XFR-over-TLS connections.
Proxy Protocol
Port number for PROXYv2 protocol service. Can be specified multiple times.
XDP (Experimental)
Interface to use XDP with. Enables AF_XDP sockets for UDP queries. (EXPERIMENTAL)
Path to eBPF XDP program.
Whether NSD should load the XDP program.
Path to bpffs for storing/reading xsks_map pin.
Force XDP_COPY mode instead of zero copy for AF_XDP sockets.
Metrics
Enable Prometheus metrics HTTP endpoint. Requires libevent2.
Bind to these addresses for serving metrics. Can be specified multiple times.
Port number for HTTP metrics service.
HTTP path to expose metrics.
Remote Control
Theremote-control: clause configures nsd-control access.
Enable remote control.
Bind to these addresses for control requests. Can be IP address, interface name, or absolute path for Unix socket.
Port number for remote control service.
Path to server private key for control connection.
Path to server certificate for control connection.
Path to control client private key.
Path to control client certificate.
Verifier Options
Theverify: clause configures zone verification.
Enable zone verification.
Port for verifier queries.
Interfaces to bind for zone verification.
Verify zones by default.
Command to execute for zone verification. The program should exit with status 0 if zone is valid.Environment variables available:
VERIFY_ZONE: Zone domain nameVERIFY_ZONE_ON_STDIN: “yes” or “no”VERIFY_IP_ADDRESSES: First address for serving zonesVERIFY_PORT: Port numberVERIFY_IPV4_ADDRESS: First IPv4 addressVERIFY_IPV6_ADDRESS: First IPv6 address
Maximum number of concurrent verifiers.
Feed the updated zone to verifier via stdin.
Maximum seconds a verifier may run. 0 means unlimited.
Pattern Options
Thepattern: clause defines reusable zone option sets.
Pattern name (case-sensitive).
Include options from another pattern (must be defined earlier).
Zone Options
Thezone: clause configures individual zones.
Zone name (apex domain). May end with
. (FQDN notation).File containing zone data. Can use substitution:
%s: Zone name%1,%2,%3: First, second, third character of zone name%z: Top-level domain%y: Next label under TLD%x: Next-next label under TLD
Access Control Lists
Allow queries from these addresses. Format:
ip-spec key-name|NOKEY|BLOCKEDIP spec can be:- Plain IP:
192.0.2.1 - Subnet:
192.0.2.0/24 - Masked:
192.0.2.0&255.255.255.0 - Range:
192.0.2.1-192.0.2.25
Allow NOTIFY from these primary addresses. Format:
ip-spec key-name|NOKEY|BLOCKEDPort can be specified: 192.0.2.1@5300Request zone transfers from this primary. Format:
[AXFR|UDP] ip-address key-name|NOKEY [tls-auth-name]AXFR: Only use AXFR (no IXFR)UDP: Use UDP for IXFR (requires TSIG)tls-auth-name: Use XFR-over-TLS
Allow fallback to AXFR if primary doesn’t support IXFR.
XFR temporary file size limit in bytes. 0 means unlimited.
Send NOTIFY to these secondary addresses. Format:
ip-address key-name|NOKEYNumber of retries when sending notifies.
Allow zone transfers to these secondaries. Format:
ip-spec key-name|NOKEY|BLOCKED [tls-auth-name]Use this IP address for outgoing AXFR/IXFR requests and notifies.
IXFR Options
Store and provide IXFR contents to secondaries.
Maximum number of IXFR versions to store.
Maximum storage for IXFR versions in bytes. 0 means unlimited.
Create IXFR data when zonefile is read. Requires
store-ixfr: yes.Timing Options
Limit refresh time for secondary zones (seconds).
Minimum refresh time for secondary zones (seconds).
Maximum retry time for secondary zones (seconds).
Minimum retry time for secondary zones (seconds).
Minimum expire time. Can be seconds or “refresh+retry+1”.
Other Zone Options
Statistics group name for this zone. Use
%s for zone name.Include options from the named pattern (must be defined earlier).
Whitelist this RRL type for the zone. Types: nxdomain, error, referral, any, rrsig, wildcard, nodata, dnskey, positive, all.
Check all primaries for the latest version.
Enable verification for this zone.
Command to execute for verifying this zone.
Feed updated zone to verifier via stdin.
Seconds before verifier is terminated. 0 means no timeout.
Set to
consumer or producer for catalog zone processing.Pattern to use for catalog member zones.
Catalog producer zone for this member zone.
Key Options
Thekey: clause defines TSIG keys.
Key name.
HMAC algorithm (e.g., hmac-sha256, hmac-sha512).
Base64-encoded secret.
TLS Auth Options
Thetls-auth: clause defines TLS authentication for XFR-over-TLS.
TLS auth configuration name.
Domain name for authentication (SAN or CN in certificate).
Path to client certificate file.
Path to client private key file.
See Also
- nsd(8) - NSD name server daemon
- nsd-checkconf(8) - Check NSD configuration
- nsd-control(8) - Control NSD remotely