BIND9 Configuration
BIND9 named.conf configuration, zone file records, rndc management, and access control.
Global Options
options {
directory "/var/named";
recursion yes;
allow-recursion { 10.50.0.0/16; };
};
directory sets the base path for zone files. allow-recursion restricts recursive resolution to internal networks only — never allow recursion from the internet.
options {
forwarders { 10.50.1.50; 8.8.8.8; };
forward first;
};
forward first tries the forwarders before doing iterative resolution. AD DNS handles inside.domusdigitalis.dev zones; public DNS handles everything else.
options {
listen-on port 53 { 127.0.0.1; 10.50.1.90; };
};
Prevents BIND from listening on unintended interfaces. Always explicit — never rely on the default of listening everywhere.
Zone Declarations
zone "inside.domusdigitalis.dev" IN {
type master;
file "inside.domusdigitalis.dev.zone";
};
The zone file contains the actual records. Path is relative to the directory option.
zone "inside.domusdigitalis.dev" IN {
type slave;
masters { 10.50.1.90; };
file "slaves/inside.domusdigitalis.dev.zone";
};
Slave pulls zone data automatically based on SOA refresh timers. The slaves/ subdirectory must exist and be writable by named.
zone "1.50.10.in-addr.arpa" IN {
type master;
file "10.50.1.rev";
};
Reverse zones follow the in-addr.arpa convention with octets reversed. Critical for RADIUS authentication and SSH host verification.
Zone File Records
$TTL 3600
One hour is reasonable for internal DNS. Lower for records that change frequently (e.g., during migrations).
@ IN SOA ns1.inside.domusdigitalis.dev. admin.domusdigitalis.dev. (
2026041001 ; Serial (YYYYMMDDNN)
3600 ; Refresh (1h)
900 ; Retry (15m)
604800 ; Expire (7d)
86400 ; Negative TTL (1d)
)
Serial must increment on every zone edit or slaves will not pull updates. The YYYYMMDDNN format allows 100 changes per day.
@ IN NS ns1.inside.domusdigitalis.dev.
Trailing dot is mandatory — it marks an absolute (fully qualified) domain name. Without the dot, BIND appends the zone origin.
ns1 IN A 10.50.1.90
ise-01 IN A 10.50.1.20
The fundamental DNS record. One record per hostname-IP pair.
www IN CNAME webserver.inside.domusdigitalis.dev.
Points to the canonical name. Cannot coexist with other record types at the same name (no CNAME + MX at the same node).
@ IN MX 10 mail.inside.domusdigitalis.dev.
Lower preference value means higher priority. Multiple MX records with different priorities provide failover.
@ IN TXT "v=spf1 mx -all"
Used for email authentication (SPF, DKIM, DMARC) and domain ownership verification.
_kerberos._tcp IN SRV 0 100 88 dc01.inside.domusdigitalis.dev.
Format: priority weight port target. AD clients use SRV records to discover domain controllers, KDCs, and LDAP servers.
20.1.50.10.in-addr.arpa. IN PTR ise-01.inside.domusdigitalis.dev.
ISE and RADIUS require matching forward and reverse records. Mismatched PTR records cause authentication failures.
rndc Commands
sudo rndc reload
No downtime. Named re-reads all zone files and applies changes.
sudo rndc reload inside.domusdigitalis.dev
Faster than full reload when only one zone changed.
sudo rndc status
sudo rndc flush
Forces fresh resolution on the next query. Use after fixing upstream records.
sudo rndc retransfer inside.domusdigitalis.dev
Don’t wait for the refresh timer. Useful after updating the master zone serial.
Validation
sudo named-checkconf /etc/named.conf
Catches syntax errors before they take down DNS. Run this before every rndc reload.
sudo named-checkzone inside.domusdigitalis.dev /var/named/inside.domusdigitalis.dev.zone
Checks SOA serial, NS records, and individual record syntax.
Access Control
allow-transfer { 10.50.1.91; };
Place inside the zone block. Never use allow-transfer { any; } — it exposes your entire zone to anyone.
acl "internal" { 10.50.0.0/16; 172.16.0.0/12; };
Reference in allow-query, allow-recursion, allow-transfer. Keeps configs DRY and auditable.
Logging
logging {
channel default_log {
file "/var/log/named/default.log" versions 3 size 5m;
severity info;
print-time yes;
print-category yes;
};
category default { default_log; };
};
Always log to a dedicated file — never rely on syslog alone for DNS debugging. print-time and print-category make logs parseable with awk.
Split-Horizon DNS
view "internal" {
match-clients { internal; };
recursion yes;
zone "example.com" IN {
type master;
file "example.com.internal.zone";
};
};
view "external" {
match-clients { any; };
recursion no;
zone "example.com" IN {
type master;
file "example.com.external.zone";
};
};
Views are evaluated in order — first match wins. Internal clients get internal IPs and recursion; external clients get public IPs and no recursion.
See Also
-
named — daemon management and diagnostics
-
Zones — zone file syntax, serial management, transfers
-
Forwarders — forwarding configuration patterns