Sub topic 5
Authoritative name servers
Prerequisites
This chapter assumes you know what a zone and a delegation are, and that you have seen the record types A, AAAA, NS, SOA and CNAME. You should be able to run dig in a terminal.
What an authoritative server is
An authoritative name server is a server that holds the original records for a zone and answers questions about it from its own data. It does not look the answer up somewhere else. The organization that runs the domain controls what the server says.
A recursive resolver is different. It answers from cache or by asking other servers, and it is not the source of the data. The two roles are separate, even though one program can sometimes do both.
An authoritative server answers only for the zones it is configured to serve. If you ask it about a name in another zone, it normally replies with a referral or a refusal. It does not go and find the answer.
Primary and secondary servers
Every zone should be served by at least two name servers, listed in its NS records. In the zone file from earlier chapters these are ns1.example.com. and ns2.example.com..
- The primary server holds the master copy of the zone. You edit the zone file here.
- A secondary server keeps a copy that it fetches from the primary. Clients cannot tell the two apart.
The secondary learns about changes through a zone transfer. The SOA record controls the timing:
- The serial number tells a secondary whether its copy is out of date. If the primary's serial is higher, the secondary transfers the zone.
- The refresh value is how often the secondary checks the serial.
- The retry value is how long it waits after a failed check.
- The expire value is how long it keeps answering if it can no longer reach the primary. After that it stops serving the zone.
The format 2026112701 is a common convention: the date plus a two-digit counter. Forgetting to raise the serial is a common mistake. The primary then has new data, but the secondaries never copy it, so different servers give different answers.
The authoritative answer flag
An authoritative server marks its replies with the aa flag, short for authoritative answer. You can see it in the header of dig output when you query a server directly.
dig @ns1.example.com example.com ALook at the flags: line in the output. A reply from the zone's own server contains aa. A reply from a recursive resolver's cache does not. This is a quick way to tell whether you are seeing the source data or a cached copy.
Glue records
There is a circular problem when a name server lives inside the zone it serves. To find www.example.com, you ask ns1.example.com. To find ns1.example.com, you would need to ask example.com's servers.
Glue records break the loop. They are A or AAAA records for the name servers, stored in the parent zone next to the delegation. The .com servers can then reply with both the NS name and its address.
; in the .com zone (parent)
example.com. IN NS ns1.example.com.
example.com. IN NS ns2.example.com.
ns1.example.com. IN A 192.0.2.53
ns2.example.com. IN A 192.0.2.54Glue is needed only when the name server's name is inside the zone it serves.
Lame delegations
A lame delegation happens when the parent zone lists a server in an NS record, but that server does not answer authoritatively for the zone. Causes include a server that was shut down, a typo in the NS name, or a zone that was never loaded on the secondary. Resolvers skip the broken server and try another, so lookups get slower. If every listed server is lame, the domain fails entirely.
Exercise
You changed an A record on the primary server, but one of two authoritative servers still returns the old address. The zone file was saved correctly. What is the most likely cause, and how do you check it?
Show answer
The SOA serial was probably not increased, so the secondary did not transfer the zone. Query both servers with dig @ns1.example.com example.com SOA and dig @ns2.example.com example.com SOA. If the serials differ, raise the serial on the primary and reload the zone.