Sub topic 18
Logging, `rndc`, `unbound-control` and Troubleshooting
Assume you can use a Linux shell, manage services with systemd, read BIND or Unbound configuration, and run basic dig queries. This chapter focuses on diagnosing a server that starts but gives wrong answers, refuses clients, or fails to load a configuration.
A practical troubleshooting path
DNS failures usually fall into one of four areas:
| Symptom | Likely area | First check |
|---|---|---|
| The service will not start | Syntax or port conflict | `systemctl status` and configuration checker |
| Queries time out | Firewall, listener, or routing | `ss`, firewall rules, and a local `dig` |
| Queries return `REFUSED` | Access control or recursion policy | `allow-query`, `access-control`, and client address |
| Answers are stale or missing | Cache, zone, or delegation | `dig`, logs, and zone serial number |
Start with the service and listener:
sudo systemctl status named unbound --no-pager
sudo journalctl -u named -u unbound -b --no-pager
sudo ss -lntup | grep ':53 'Distribution names differ. On some systems, BIND runs as named; on others, the service is called bind9. Query the service name used by your distribution.
The systemd journal commonly contains startup errors, permission failures, failed zone loads, and refused control connections. Follow new messages while reproducing a problem:
sudo journalctl -fu namedFor Unbound:
sudo journalctl -fu unboundValidate before reloading
A reload can fail without stopping the currently running configuration. Always check the new configuration first.
sudo named-checkconf
sudo named-checkzone example.com /etc/bind/db.example.com
sudo unbound-checkconfnamed-checkzone checks both syntax and record consistency for one zone. A successful check does not prove that delegation, firewall rules, or client permissions are correct.
Control a running server
rndc is BIND’s authenticated control utility. It can show status, reload configuration, reload one zone, and clear cached data.
sudo rndc status
sudo rndc reload
sudo rndc reload example.com
sudo rndc flushunbound-control provides similar operations for Unbound. It requires the control interface and keys to be configured.
sudo unbound-control status
sudo unbound-control reload
sudo unbound-control flush_zone example.org
sudo unbound-control stats_noresetIf a control command fails, check that the daemon is running and that its control socket, certificates, or key files have the expected ownership and permissions.
Use `dig` to isolate the failure
Test each layer separately:
dig @127.0.0.1 www.example.com A
dig @192.0.2.10 www.example.com A
dig @192.0.2.10 example.com SOA +norecurse
dig @192.0.2.10 example.com NS +tcpA local success followed by a remote timeout points toward listening addresses, a firewall, or network routing. REFUSED usually indicates policy. SERVFAIL often means DNSSEC validation, forwarding, delegation, or an unavailable upstream server failed.
Exercise
A local query succeeds, but a query from a LAN client returns REFUSED. What should you inspect first?
Show answer
Inspect the resolver's client access rules and confirm that the client's source network is allowed. Then check the firewall and repeat the query from the client.