Sub topic 11
Serving Your Zone with BIND
Prerequisites and the authoritative role
Assume you can use a Linux shell, edit files, manage systemd services, and read basic DNS records. This chapter uses Debian or Ubuntu paths. The addresses in the examples use documentation ranges and must be replaced in a real network.
An authoritative DNS server answers from its own zone data. It does not search the root servers for unrelated names. For a public zone, the parent zone must delegate the name to this server with NS records and, when necessary, glue records.
Configure BIND as a primary
A primary server is the source of the zone data. On Debian and Ubuntu, put the zone declaration in /etc/bind/named.conf.local:
acl "trusted" {
127.0.0.1;
192.0.2.0/24;
};
options {
directory "/var/cache/bind";
listen-on { 127.0.0.1; 192.0.2.10; };
allow-query { any; };
recursion no;
};
zone "example.com" {
type primary;
file "/etc/bind/db.example.com";
allow-transfer { 192.0.2.11; };
};recursion no prevents this server from becoming a general-purpose resolver. allow-transfer permits the listed secondary server to copy the zone. A later chapter adds TSIG authentication to that transfer.
Create /etc/bind/db.example.com:
$TTL 3600
@ IN SOA ns1.example.com. hostmaster.example.com. (
2026112801 ; serial
7200 ; refresh
3600 ; retry
1209600 ; expire
3600 ) ; negative caching TTL
IN NS ns1.example.com.
IN NS ns2.example.com.
IN MX 10 mail.example.com.
ns1 IN A 192.0.2.10
ns2 IN A 192.0.2.11
www IN A 192.0.2.20
mail IN A 192.0.2.25The SOA serial identifies the version of the zone. Increase it every time you change the zone. A date plus a two-digit revision, such as 2026112801, is a common format. The final dot in fully qualified names is important. Without it, BIND may append example.com again.
Validate, reload, and test
Check the global configuration and the zone before reloading:
sudo named-checkconf
sudo named-checkzone example.com /etc/bind/db.example.com
sudo rndc reload example.com
dig @192.0.2.10 www.example.com A +norecurse
dig @192.0.2.10 example.com SOA +shortThe first query should return 192.0.2.20 and include the aa flag. That flag means the response came from authoritative zone data. +norecurse confirms that the server is not being asked to find the answer elsewhere.
Exercise
You change the www address but forget to increase the SOA serial. What problem can this cause when a secondary server is used?
Show answer
The secondary may keep its older copy because it compares SOA serials and sees no newer zone to transfer.