DNS Server Slave – NS record in master

domain-name-system

I'm setting up a basic DNS system with a master server (1.1.1.1) and a slave server (2.2.2.2) for "example.com" domain.

I don't know if I should add the NS record in the master server for the slave server as this example:

; Records in MASTER server 1.1.1.1
; name servers
  IN  NS     ns1.example.com. ; DNS Int 1 - MASTER
  IN  NS     ns2.example.com. ; DNS Int 2 - SLAVE

; glue records
  ns1       IN  A      1.1.1.1  ; name server definition MASTER
  ns2       IN  A      2.2.2.2  ; name server definition SLAVE   

What's the difference in adding, or not, the NS record for the slave server? I understand that the NS record means that THOSE servers there are authoritative for the domain, "example.com" in this case. But, if I do not add the NS record for the master server, I'd still get authoritative answers from the slave as it got he's zone information from the master.

So what's the difference?

Thanks!

Best Answer

Given your example, there are actually two questions that need to be answered here.

Do I need multiple nameservers?

Yes. A thousand times yes. If an authoritative nameserver for your domain can't be reached, it vanishes from the internet. You must have multiple nameservers and they must be geo-redundant, i.e. located at different physical locations.

  • Server hardware dies. It's inevitable.
  • Site level disasters happen. Fire, flood, earthquakes, electrical surges, etc. Your DNS servers should not be physically at the same site in order to be resilient to unplanned disasters.
  • Routing problems happen. If all of your DNS servers share a common upstream peer, they vanish from the internet when that peer experiences a total outage. When routing problems occur between that peer and specific remote networks, all of your servers become unavailable to remote devices that are behind that routing path. Having multiple servers that do not share an upstream peer make you significantly more resilient to upstream routing problems of all sorts.

What is the difference between listing a master and a slave in the NS records?

From the perspective of a DNS client, there is no difference at all. From the perspective of a server admin, it's a best practice to only expose the slave servers to the internet and have a "hidden" master that only the slave servers and your private networks can communicate with.

  • Downtime for the master doesn't impact your internet facing redundancy. The slaves can be disconnected from the master for quite some time with there being no ill effects. The maximum length of time is determined by the expiry field in the SOA record of every zone hosted on the slaves.
  • Fewer mistakes are exposed to the internet facing name servers. Major syntax problems are unlikely to be allowed to propagate over zone transfers. Even if you make a mistake so significant that it results in the nameserver process self-terminating, or entire domains being unloaded, the worst that happens to the slaves is that they briefly lose contact with the master. The clients don't notice a thing.
  • Security benefits. If the master is compromised, changes can be pushed to all of the slave servers by an attacker. If a slave server is compromised, changes can only be made to that one server. (of course, if you let them into one server, odds are pretty good that the others have similar exploits they can rely on...but reduced profile still doesn't hurt)
Related Topic