Sub topic 3
Authoritative Servers, Recursive Resolvers and Forwarders
This chapter assumes that you can use a Linux shell, install packages, manage systemd services, and read IP addresses and ports. You should also know that DNS normally uses UDP port 53, but can use TCP port 53 for large replies and zone transfers.
Three different DNS jobs
DNS software can perform different jobs. Keep these roles separate when designing a server:
| Role | Main question | Typical data source |
|---|---|---|
| Authoritative server | “What records exist for this zone?” | Its own zone files |
| Recursive resolver | “What is the answer to this name?” | Other DNS servers and its cache |
| Forwarder | “Which upstream server should answer this query?” | A configured upstream resolver |
An authoritative server has final responsibility for one or more DNS zones. For example, an authoritative server for example.com stores records such as www.example.com A 192.0.2.20. It does not need to contact another server to answer that name. It normally has recursion disabled.
A recursive resolver accepts a question from a client and finds the answer. If the answer is not cached, it starts with a root server, follows referrals to a top-level-domain server, and then follows a referral to the authoritative server for the requested zone. It caches the result until its time to live, or TTL, expires.
A forwarder sends queries to another resolver instead of resolving them directly. The upstream server might be your internet provider, a company resolver, or a filtering service. Forwarding reduces the number of external connections made by your server, but it makes your answers depend on that upstream server.
How the roles work together
A common small-network design gives clients access to a recursive resolver. That resolver can answer local names from local data and forward public queries to an upstream resolver. A separate authoritative server can host your public or internal zones.
The same program can sometimes provide more than one role, but combining roles increases the chance of an access-control mistake. An authoritative server exposed to the internet should not also offer unrestricted recursion.
Choosing the role
Use an authoritative server when you control the zone and need other resolvers to query your records. Use a recursive resolver for clients that need answers for many domains. Use forwarding when another resolver should perform external lookups or enforce central policy.
BIND supports authoritative service, recursion, forwarding, and zone transfers. Unbound is focused on recursive and validating resolution, with useful support for local data. Choose based on the role you need rather than on the software name.
# Ask a specific server without using the system resolver
dig @192.0.2.10 www.example.com A
# Request only an authoritative answer
dig @192.0.2.10 example.com SOA +norecurse
# Show the path of an iterative lookup
dig +trace www.example.comThe aa flag in a response means the responding server is authoritative for the answer. A recursive answer may instead contain cached data and have the ra flag, meaning recursion is available.
Exercise
A server hosts example.com records and has recursion disabled. Is it authoritative, recursive, or a forwarder?
Show answer
It is an authoritative server because it answers from its own zone data and does not resolve unrelated names.