Linux course index · Linux Advanced category · Lesson 5 of 9
AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.
Learning goal
Build an authoritative forward zone and distinguish an authoritative answer, NXDOMAIN, and no response.
Concepts and setup
The site’s Ubuntu DNS walkthrough uses the example.test zone and BIND. This lab starts an unprivileged instance on 127.0.0.1:1053. Install BIND tools from your distro for named, named-checkconf, named-checkzone, and dig. Leave system resolver settings unchanged. An authoritative server answers for its own zone. A recursive resolver searches on a client’s behalf. This instance deliberately does not recurse.
If an AppArmor or other system policy blocks the temporary path, use a supported custom instance or an approved lab VM. Do not deactivate system protections to make a fixture work.
Write and validate the zone
lab=$(mktemp -d)
cd "$lab" || exit
cat > zone.db <<'EOF'
$TTL 300
@ IN SOA ns.example.test. hostmaster.example.test. (
2026111601 3600 900 1209600 300 )
@ IN NS ns.example.test.
ns IN A 192.0.2.53
app IN A 192.0.2.20
EOF
cat > named.conf <<EOF
options {
directory "$lab";
listen-on port 1053 { 127.0.0.1; };
listen-on-v6 { none; };
recursion no;
pid-file "$lab/named.pid";
};
controls { };
zone "example.test" {
type primary;
file "zone.db";
};
EOF
named-checkconf "$lab/named.conf"
named-checkzone example.test "$lab/zone.db"
Possible output
zone example.test/IN: loaded serial 2026111601
OK
A good named-checkconf often prints nothing. Dots after fully qualified names stop them being treated as relative. The records use documentation addresses.
Start the server and query two names
# Terminal A, in the same shell as the previous block:
named -g -c "$lab/named.conf"
# Terminal B, after the instance is ready:
dig @127.0.0.1 -p 1053 +norecurse app.example.test A +noall +comments +answer
dig @127.0.0.1 -p 1053 +norecurse missing.example.test A +noall +comments
# Press Ctrl-C in Terminal A when finished.
Possible output
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: ...
;; flags: qr aa; ...
app.example.test. 300 IN A 192.0.2.20
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: ...
;; flags: qr aa; ...
An existing name without a record of the requested type can instead return NOERROR with no answer records. Do not use dig +short when you need to see that distinction.
Questions only
Quick-check questions
- What does aa indicate?
- Should the lab server recurse for arbitrary names?
Assessment questions
- Add docs.example.test with address 192.0.2.21. What else changes in the zone?
- What may happen if the NS target omits the final dot?
- How can you distinguish NXDOMAIN from a timeout?
Questions and answers
Quick-check answers
- What does aa indicate?
Answer — The responding server marked the answer authoritative. - Should the lab server recurse for arbitrary names?
Answer — No. Recursion is deliberately off.
Assessment answer key
- Add docs.example.test with address 192.0.2.21. What else changes in the zone?
Answer — Add docs IN A 192.0.2.21 and increment the SOA serial. Revalidate, restart the lab instance, and query the new record. - What may happen if the NS target omits the final dot?
Answer — The server may append the zone origin to the relative target. - How can you distinguish NXDOMAIN from a timeout?
Answer — NXDOMAIN is a received DNS response code. A timeout means a usable reply was not received in time.
Source articles on this site
- Step by step DNS Server installation in ubuntu in a fresh VM
- Linux Commands Demo DNS related, Ubuntu #Root #By Sayed Ahmed #RHCSA
- DNS: How to configure a DNS server in Linux #74
- Basic Commands for Networking in Linux
Technical references
Continue the course
Previous lesson 04 — Firewall Zones and Runtime Rules. Next lesson 06 — DHCP Leases and a Kea Lab.
Linux course index · Linux Advanced category · Lesson 5 of 9
