I want to set up a local Dynamic DNS (DDNS) server for the workstations in my office's local network without serving DHCP. The domains of the workstations end with .office.internal. Optionally, the domains other than *.office.internal can be resolved by upstream server dns.usc.edu. In addition, it would be better to be lightweight and easy to configure. I do not want to use dnsmasq because it requires to set up DHCP. What is the best choice of the DNS server other than dnsmasq that meets my requirements? How to configure it to do so?
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
To meet your requirements for a lightweight, easy-to-configure DNS server that supports local Dynamic DNS (DDNS) for .office.internal domains and forwards other queries to an upstream DNS server (dns.usc.edu), BIND9 or Unbound are excellent choices. Both are widely used, reliable, and do not require DHCP functionality.
Recommended Solution: BIND9
BIND9 is a robust and flexible DNS server that can handle DDNS updates and forward queries to an upstream server. Below is a step-by-step guide to configure BIND9 for your use case:
Edit the main configuration file (/etc/bind/named.conf.local):
Add a zone for .office.internal:
plaintext
zone "office.internal" {
type master;
file "/etc/bind/db.office.internal";
allow-update { key ddns-key; };
};
Create the zone file (/etc/bind/db.office.internal):
This file defines the initial records for the .office.internal domain:
plaintext
$TTL 604800
@ IN SOA ns1.office.internal. admin.office.internal. (
2023101001 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.office.internal.
ns1 IN A 192.168.1.1 ; Replace with your server's IP
Set up a TSIG key for secure DDNS updates:
Generate a key using dnssec-keygen:
bash
dnssec-keygen -a HMAC-SHA256 -b 128 -n USER ddns-key
This will create two files (e.g., Kddns-key.+123+45678.key and .private). Extract the key from the .key file:
After completing the configuration, restart the BIND9 service:
bash
sudo systemctl restart bind9
Step 4: Test the Configuration
Query the local domain:
bash
dig workstation1.office.internal @localhost
Ensure it resolves correctly.
Query an external domain:
bash
dig google.com @localhost
Verify that it forwards the query to dns.usc.edu.
Update the DDNS record (optional):
Use nsupdate to dynamically update the DNS record:
bash
nsupdate
> server localhost
> key ddns-key your-base64-encoded-secret-key
> zone office.internal
> update add workstation2.office.internal 3600 A 192.168.1.10
> send
Alternative Solution: Unbound
If you prefer an even lighter solution, Unbound is a caching DNS resolver that can be configured to handle local zones and forward queries. However, it does not natively support DDNS updates. If DDNS is critical, BIND9 is the better choice.
Summary
BIND9 is the best choice for your requirements due to its DDNS support, flexibility, and ease of configuration.
The configuration involves setting up a local zone for .office.internal, enabling DDNS updates with a TSIG key, and forwarding non-local queries to dns.usc.edu.
If DDNS is not strictly necessary, Unbound can serve as a lightweight alternative for local resolution and forwarding.
Let me know if you need further clarification or assistance!