DNS Queries Explained

DNS (Domain Name Service) is a very critical service required for almost every communication in Internet, DNS resolutions can be categorized into two types which is forward lookup and reverse lookup, in this article I will be explaining different types of DNS queries that are part of forward lookup process during domain name resolutions.
 

Forward Lookup of DNS process contains 3 types of DNS queries viz

1. Recursive Query
2. Iterative Query
3. Non-Recursive Query

Recursive Query

A recursive query is a query in which the DNS server which receives the query will do all the job of fetching the answer. During this process the queried DNS server might also query other DNS server's in the internet on clients behalf for the resolution. Recursive Query can be generally found in caching DNS server which go through following steps for resolution.
 

a. When a dns client of  operating system sends a query to a DNS server (Cache Server) to resolve a domain, the DNS server will try to resolve the domain name to ip address through its cache entries if the same is not available with itself then it will forward the same to one of the root server. 

b. The root server in turn which is configured as iterative server will reply back with the list of servers also called referral that are responsible for the respective TLD's (Top level domains) to which the requested domain is part of.

c. Now the cache dns server will send the query to one of the TLD server based on the reply received for domain resolutions, the TLD dns server which recives this query will in turn reply back with the referral of the Authoritative name server that is responsible for resolving the domain.

d. Now finally cache DNS server will send the query to Authoratative name server, Authoratative name server will reply back with the ip address of the domain based on the records available in its zonefile for the domain.

e. The resolved ip received by cache DNS server will be now forwarded to DNS client by the Cache DNS server.

From the above steps it can be seen that when DNS client requested for a domain name resolution, Cache DNS server took the efforts to go through all the DNS servers till  domain name was resolved and replied back with resolution.


Iterative Query

A Iterative Query is a query in which the DNS server which receives the query to resolve the domain name will not go and fetch the answer for the query but will give back the referral to another DNS server which might have the answer and the client will now has to request the name resolution to this new referred server, this process is repeated till the query is resolved as seen in steps below

-  When a DNS client of a operating system send a query to a DNS server (cache server) to resolve a domain the DNS server will try to resolve the domain name using its cache entries if the same is not available then it will reply back with the referral of list of root servers.

- Now the DNS client will forward the query to one of the referred root server from the list, the referred root server will now reply back with the list of TLD's to which the requested domain is part of.

- Now the DNS client will now forward the query to one of the referred TLD DNS, the TLD will check its records and will reply back with the Authoritative name server that is responsible for resolving the domain.

- Finally DNS client will now forward the query to the Authoratative name server, the Authoratative name server will check its zone file records and will reply back with the ip address of the domain that needs to be resolved.



From the above steps it can be seen that here DNS client had to iterate through all the DNS servers based on referral's received till requested domain named was resolved.

Note:- A Referral is the response from DNS server that says I don't know the answer, but try this server it may know the answer.


Non-Recursive Query

A non-recursive query is a query in which the DNS Resolver already knows the answer. It either immediately returns a DNS record because it is already available in its local cache, or other scenario would be if queries are sent to DNS Name Server directly which is authoritative for queried record, meaning it definitely holds the correct IP for that query requested. In both this cases, there is no need for additional rounds of queries (like in recursive or iterative queries). Here, a response is immediately returned to the client.


 

Hope this post was helpful in explaining different types of queries used in DNS resolutions.

Comments

Popular posts from this blog

DNS Glue records

Reverse DNS Lookup

MTU vs MSS