Once upon a time I used to play with DNS zones & domains for breakfast, but it’s been a while and I find myself to be a bit rusty.
Anyways, something I realized / remembered today – a DNS domain is not equal to a DNS zone. When creating a DNS domain under Windows, using the GUI, it is easy to equate the domain to the zone; but if you come from a *nix background then you know a zone is the zone file whereas domains are different from that.
For example here’s a domain called “domain.com” and its sub-domain “sub.domain.com”.
You would think there wouldn’t be much difference between the two but the fact is that “domain.com” is also the zone here and “sub.domain.com” is a part of that zone. The domain “sub.domain.com” is not independent of the main domain “domain.com”. It can’t have its own name servers. And when it comes to zone transfers “sub.domain.com” follows whatever is set for “domain.com”. You can’t, for instance, have “domain.com” be denied zone transfers while allowing zone transfers for “sub.domain.com” – it’s simply not possible, and if you think about it that makes sense too because after all “sub.domain.com” doesn’t have its own name servers.
In this case the zone “domain.com” consists of both the domain “domain.com” and its sub-domain “sub.domain.com”.
In contrast below is an example where there are two zones, one for “domain.com” and another for “sub.domain.com”. Both domain and sub-domain have their own zones (and hence name servers) in this case.
When creating a new domain / zone the GUI makes this clear too but it’s easy to miss out the distinction.
Stub zones
We use stub zones at work and initially I had a domain “sub.domain.com” which I wanted to create a a stub zone on another server. That failed with an error that the zone transfer failed.
Initially I took this to mean the stub zone was failing because the zone wasn’t getting transferred from the main server. That was correct – sort of. Because “sub.domain.com” isn’t a zone of its own, it doesn’t have any name servers. And the way stub zones work is that the stub server contacts the name servers of “sub.domain.com” to get a list of name servers for the stub zone but that fails because “sub.domain.com” doesn’t have any name servers! It is not a zone, and only zones have name servers, not (sub-)domains.
1 2 3 4 5 6 7 |
C:\>nslookup -type=NS sub.domain.com win-dc03 Server: win-dc03.rakhesh.local Address: 10.50.0.22 DNS request timed out. timeout was 2 seconds. *** win-dc03.rakhesh.local can't find sub.domain.com: Non-existent domain |
So the error message was misleading. Yes, the zone transfer failed, but that’s not because the transfer failed but because there were no servers with the “sub.domain.com” zone. What I have to do is convert “sub.domain.com” to a zone of its own. (Create a zone called “sub.domain.com”, create new records in that zone, then delete the “sub.domain.com” domain).
Worth noting: Stub zones don’t need zone transfers allowed. Stub zones work via the stub server contacting the name servers of the stub zone and asking for a list of NS, A, and SOA records. These are available without any zone transfer required.
In our case we wanted to create a stub host record. We had an A record “host.sub.domain.com” and wanted to create a stub to that from another server. The solution is very simple – create a new zone called “host.sub.domain.com”, create a blank A record in that with the IP address you want (same IP that was in the “host.sub.domain.com” A record), then delete the previous “host.sub.domain.com” A record.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
C:\>dnscmd win-dc03 /zoneprint host.sub.domain.com ; ; Zone: host.sub.domain.com ; Server: win-dc03 ; Time: Fri Jul 10 03:29:42 2015 UTC ; @ 3600 A 1.1.1.1 3600 NS win-dc03.rakhesh.local. 3600 SOA win-dc03.rakhesh.local. hostmaster.rakhesh.local . 2 900 600 86400 3600 ; ; Finished zone: 1 nodes and 3 records in 0 seconds ; |
Now create a stub zone for that record:And that’s it.
Just to recap: zones contain domains. A domain can be spread (as sub-domains) among multiple zones. For zone transfers and stub zones you need the domain in question to be in a zone of its own.