nsd-control utility performs remote administration on the NSD server. It reads the configuration file, contacts the NSD server over SSL, sends commands, and displays results.
Setup
Before usingnsd-control, you need to set up SSL certificates:
-
Generate certificates:
This creates self-signed certificates and private keys for both server and client.
-
Enable control interface in
nsd.conf: -
Restart NSD:
Command-Line Options
-h- Show version and command-line help-c cfgfile- Use specified config file (default:/etc/nsd/nsd.conf)-s server[@port]- IPv4 or IPv6 address of server to contact (overrides config file)
Basic Commands
start
Start the NSD server:nsd binary. The NSD executable is searched relative to the installation prefix. You can override the location by setting the NSD_PATH environment variable.
stop
Stop the NSD server:status
Display server status:0- Server is running1- Error occurred3- Server is not running (connection refused)
reload
Reload zone files and reopen log file:With argument: reads the zone file for the specified zone Example:
reconfig
Reload configuration and apply changes:nsd.conf and applies:
- TSIG key changes
- Pattern configuration updates
- Zone additions/removals mentioned in config
repattern
Alias forreconfig:
Zone Management Commands
See Zone Management for detailed zone commands.Zone Transfer Commands
See Zone Transfers for transfer-related commands.Logging Commands
log_reopen
Reopen the log file (for log rotation):verbosity
Change or display logging verbosity:With argument: sets verbosity to specified level Examples:
Statistics Commands
stats
Output statistics information:stats_noreset
Same asstats, but does not zero the counters:
serverpid
Print the PID of the server process:nsd.pid instead.
TSIG Key Commands
print_tsig
Print TSIG key information:With argument: prints the secret and algorithm for the specified key Example:
add_tsig
Add a new TSIG key:name- Key namesecret- Base64 encoded secretalgo- Algorithm (default:hmac-sha256)
update_tsig
Change an existing TSIG key secret:del_tsig
Delete a TSIG key:assoc_tsig
Associate a zone with a TSIG key:Cookie Secret Commands
add_cookie_secret
Add or replace a cookie secret:- Active - Used to create DNS Cookies
- Staging - Only used for verification
activate_cookie_secret
Make the staging cookie secret active:drop_cookie_secret
Drop the staging cookie secret:print_cookie_secrets
Show current cookie secrets with status:Rolling Cookie Secrets (Anycast)
For anycast deployments:-
Add new secret as staging on all nodes:
- Wait for all nodes to have the new secret
-
Activate the new secret on all nodes:
- Wait at least one hour
-
Drop the old (now staging) secret on all nodes:
Exit Codes
0- Success1- Error
Files
/etc/nsd/nsd.conf- Default configuration file/etc/nsd/nsd_server.key- Server private key/etc/nsd/nsd_server.pem- Server certificate/etc/nsd/nsd_control.key- Control client private key/etc/nsd/nsd_control.pem- Control client certificate
See Also
- Running NSD - Starting and stopping NSD
- Zone Management - Managing zones
- Zone Transfers - Transfer operations
- Monitoring - Statistics details