Installing NSD
NSD can be installed via package managers on most systems, or built from source for custom configurations and the latest features.System Requirements
Before installing NSD, ensure your system meets these requirements:Operating System
NSD runs on Unix-like operating systems:- Linux (all major distributions)
- FreeBSD, OpenBSD, NetBSD
- macOS
- Solaris
Hardware Requirements
Minimum requirements:
- CPU: Any modern processor (64-bit recommended)
- RAM: 512 MB minimum (scales with zone size)
- Disk: 100 MB for binaries + space for zone files
- Multi-core CPU for parallel query processing
- 2+ GB RAM for large zone datasets
- SSD storage for faster zone loading
Dependencies
NSD requires several libraries and tools:Required Dependencies
Optional Dependencies
For additional features:- libxdp, libbpf, libcap - For XDP (AF_XDP) socket support
- protobuf-c - For dnstap logging support
- systemd development files - For systemd integration
Installing from Packages
The easiest way to install NSD is through your system’s package manager.Post-Installation Steps
After installing via package manager:Check Installation
Verify NSD is installed correctly:This shows version information and compile-time options.
Building from Source
Building from source gives you the latest version and full control over compile-time options.Downloading the Source
Compiling NSD
Configure the Build
Run the configure script to check dependencies and set options:The configure script will:
- Check for required dependencies
- Detect system capabilities
- Set default installation paths
Use
./configure --help to see all available configuration options.Common Configure Options
Customize your build with configure options:Configure options
Key configure options:
--prefix=/path- Installation prefix (default: /usr/local)--sysconfdir=/path- System configuration directory--with-configdir=/path- NSD configuration directory--with-user=username- User to run NSD as (default: nsd)--with-libevent=/path- Path to libevent installation--with-ssl=/path- Path to OpenSSL installation--enable-ratelimit- Enable response rate limiting--enable-recvmmsg- Enable recvmmsg/sendmmsg for better performance--enable-nsec3- Enable NSEC3 support (requires OpenSSL)--enable-minimal-responses- Reduce response sizes to minimize truncation--enable-xdp- Enable XDP support (requires libxdp, libbpf, libcap)--enable-packed- Use packed structure alignment (less memory, unaligned reads)--disable-ipv6- Disable IPv6 support
Building with Advanced Features
XDP Support (Ultra-High Performance)
For maximum performance with AF_XDP sockets:XDP build
DNStap Logging Support
For detailed query logging with dnstap:DNStap build
Testing the Installation
Verify your NSD build:Run in Debug Mode
Test NSD runs without errors:Options:
-d- Run in foreground (debug mode)-c- Specify config file-V 3- Increase verbosity level
Creating the NSD User
For security, NSD should run as an unprivileged user:Create nsd user
Setting Up nsd-control
Thensd-control utility allows you to control NSD remotely:
Generate Control Keys
/etc/nsd/nsd_server.key- Server private key/etc/nsd/nsd_server.pem- Server certificate/etc/nsd/nsd_control.key- Control private key/etc/nsd/nsd_control.pem- Control certificate
Systemd Integration
For systemd-based systems, create a service unit:/etc/systemd/system/nsd.service
Troubleshooting Installation
Configure Fails to Find OpenSSL
Configure Fails to Find libevent
Flex or Bison Not Found
Ensure both are installed:Permission Denied on Port 53
NSD needs root to bind to port 53, then drops privileges:Next Steps
Now that NSD is installed, proceed to configuration:Quick Start Guide
Get NSD up and running with a basic configuration