What is a “Domain Name Server” and how does it work?
The domain name server is a server application that provides a cross-reference or mapping service between symbolic names and their respective IP addresses. DNS is an application layer (layer 7) protocol under OSI’s seven-layer model.
Let us consider the following scenario: User “John” wants to reach the host “maniac.synapse.com”. For discussion purposes, let’s assume that the IP address of “maniac” is 184.108.40.206.John only knows the host as “maniac.syanpse.com”; he does not know the IP address. How can he successfully connect to “maniac”? Here is where DNS comes into the picture.
There are two ways to provide a mapping service between symbolic host names and actual IP addresses. The first is to have each host resolve symbolic names locally. Therefore, each host must maintain a table that provides the mapping between names and addresses. This technique can be termed “flat namespace” and will work well in small network situations.
For large networks and the Internet itself, the flat namespace method simply breaks down. Imagine every host on the Internet having a table that contains the address resolution information for every other host! What’s worse is when a new host is added, all the tables have to be changed!
Enter the Domain Name System. Rather than having a flat namespace, we now are introduced to a “distributed namespace.” Distributed namespace means is that hosts are grouped into domains or zones. In each one of these domains, name resolution is handled by a server(s). This server maintains a name to address mapping tables only for the zone or domain for which it is responsible. The domains can now be logically grouped and interconnected in a hierarchical tree fashion.
Hierarchical Tree Structure of Domains
In the above diagram, the branch to “maniac”, when traced upward, reveals the symbolic host name, i.e. “maniac.synapse.com”.
Typically, a DNS server under the “Synapse” branch provides the name resolution for all local hosts. Let’s suppose that a user under the “Synapse” domain wants to connect to the host “Maniac”. The DNS query will be initiated by the user and answered within the domain by the DNS server.
Now let’s imagine that a user under the “Edu” domain is looking for “maniac.synapse.com”. In this scenario, the DNS request is forwarded by the name-resolver under the user’s local domain upward via the branches of the tree until the “Com” branch is reached. Then the request descends via the “Synapse” and eventually to the DNS server, say “dns1.synapse.com”. The server “dns1” contains the IP address for “maniac” and will reply to the user’s query.
The name resolution process itself can be described as follows:
- The user generates a DNS query; for instance, “Where is maniac.synapse.com”
- The local name server (the DNS server’s address is known to the user under static IP configuration or is provided in the course of DHCP or dynamic host configuration protocol, which assigns an IP address to the user) will first consult its cache in an attempt to resolve the name. How long a record remains in the DNS server’s memory cache is dependent on the TTL (time to live) parameter.
- If the DNS server finds the mapping in its own cache, it answers the user’s query with the IP address information; in this example, the address for “maniac”.
- If it does not find the mapping in its cache, the DNS server will reference one or more name server addresses that it maintains, in an attempt to consult them for the right answer.
The DNS server will then query the name server(s) for the mapping information until an authoritative answer is found. If not, a “name not found” message is delivered to the user.