Can I configure a TLD in a DNS server?

I'm pretty new to DNS. From what I've learnt so far, I know that: when a DNS server is asked to resolve some domain name (assuming all caches are empty), it will first contact a root name server, and ask for the name sever of the TLD, and keep asking his way to the authoritative name server of the domain name in question.

My question is, say I have a company with a local network with a bunch of machines, printers and services etc. Can I have a domain name for my internal network so that each machine and service will have a domain name? I know that it's possible, my question is more how is it possible? Since it seems that when a DNS server is asked for a domain name it goes from top (root servers) to bottom, so how can I have a domain name that is not part of this public hierarchy?


Solution 1:

The key point is that when a DNS server is queried for a domain name it does not necessarily start with the official root servers. There are exceptions to that rule which offer you the opportunity to insert your own domain.

Generally speaking, when the DNS server already knows the answer for a query then it uses that answer instead of going through the complete drill starting at the root servers. This applies on all levels. So when a DNS server is asked for somehost.subdom.example.com and it already knows the NS record for example.com, it will start with that knowledge and proceed from there directly to subdom.example.com instead of unnecessarily asking the root servers for the NS record for com again. Possible sources for that knowledge include the cache of recent queries but also the DNS zones which are configured locally on the server.

Consequently, if you configure a zone example.com on your DNS server then every query for a domain name below example.com going through that server will effectively be served from that zone, masking out any results for the same query from the public DNS hierarchy. You'll have created your own private version of that domain. Note that any query not going through your DNS server will still return the results from the public DNS hierarchy, so you'll want to make sure that all DNS queries from your company network go (directly or indirectly) to your DNS server which has that extra zone.