What is DNS differentiate between recursive and iterative queries explain the formats of the query and response messages used in DNS?

Introduction to DNS Types

DNS (Domain Name System) types are defined as an automatic process that converts the domain name to its corresponding IP(Internet Protocol) address or number so that web browser can understand which web page we want to access on the internet, it is a central part of the internet which provides a way to match a website that we are looking for and the address of the website we are looking for, anything (laptop, tablets, mobile phones, website) connected to the internet has an IP address, when a URL is typed into a browser then DNS server returns the IP address of web server which is associated with that name.

Top 3 Types of DNS

There are three DNS types :

1. DNS queries

DNS query is also known as a DNS request. So, it is a request for information that is sent from the user’s computer to ask for the IP address to a DNS server. This means the DNS client is querying the DNS server to get the IP address, related to that domain.

Three types of queries occurs in DNS query:

  • Recursive Query: Recursive query is a type of query in which the DNS server will do all the job of answering the users. In recursive query DNS server querying to the other DNS server on behalf of the user. When the user requesting by asking name to the server, the server performs complete translation and the user directly gets the IP address of the domain.
  • Iterative Query: In an iterative query, the user can request repeatedly to the different DNS servers for resolution. It means iterative DNS query is a request for a website or URL, DNS server responds with the IP address, if the server does not have the requested IP address then request forwarded to other DNS server.
  • Non-Recursive Query: The non-recursive query is a query in which the DNS Resolver already knows the answer. That either immediately returns the DNS records or queries the name server which is authoritative for the records, because that stored in local cache, immediate response to be given to the user.

2. DNS Servers

DNS servers convert domain names into IP addresses. It takes request from human and converts that into machine IP addresses that make easier to reach the origin server.

  • DNS Resolver: DNS resolver is also called a recursive resolver, it converts hostname into IP address which is machine friendly. This server is designed to receive queries from web browsers and other applications. This resolver receives a hostname in the form of www.sample.com and also responsible for tracking the IP address for that hostname.
  • DNS Root Server: Root servers are the DNS name servers that are operated in the root zone, root zone is the stored record of queries so that server can directly answer the query from the root zone or cache within the root zone. The DNS uses 13 DNS servers and that is based on a constraint of Internet Protocol version 4.
  • Authoritative Name Server: The authoritative name server is the higher level in DNS. The DNS server is the ‘authoritative’, the authoritative name is given to the specific hostname because it holds the up-to-date information about that hostname.

3. DNS Records

DNS server created a DNS record to give important information about the domain or hostname and its current IP address.

The common DNS record types are –

  • Address mapping record (A record): Address mapping record is known as ‘A record’, it is a host of DNS record which stores a hostname and its corresponding IP address, it means that to provide the IP address associated with the domain name. It is a type of DNS record .
  • IP version 6 address record (AAAA record): Internet Protocol version 6 record is the second type of DNS record and is also called as ‘AAAA record’. The ‘AAAA record’ stores the information of hostname and IP address related to version 6.
  • Canonical Name Record (CNAME record): The Canonical name record is shortened as ‘CNAME’. The ‘CNAME’ maps one domain name to other, for example, the ‘CNAME’ record can map the web address which is taken to the actual website.
  • Mail Exchanger Record (MX Record): Mail exchange record is called an MX record. It represents the mail server that is responsible for accepting email messages on behalf of the domain name, all the emails sent to the recipients first will be sent to the mail server with the IP address and then the recipient gets that email.
  • Name Server Record (NS Record): The name server record is shortened as an ‘NS Record’. It specifies the domain name of the name server. This record is present at the top of your domain, these are public and these types of records are store only at specific locations.
  • Reverse-lookup pointer record (PTR Record): A reverse-lookup pointer record is also known as a PTR record. It provides a domain name that is associated with an IP address. It is opposite to the ‘A record’. The PTR record is used in the lookup of DNS.
  • Certificate Record (CERT Record): The certificate record is shortened as ‘CERT Record’. It stores the encrypted certificates and provides information to the authentic recipients only.
  • Service Location (SRV Record): The service location records store the data about location (i.e. hostname, port number) in the domain name server. It is a DNS resource record that is used to locate domain controllers for the active directory.
  • Text Record (TXT record): A text record is the type of DNS record that contains text information for sources outside of the domain, also carries machine-readable data such as encryption, sender policy, etc.
  • Start of Authority (SOA Record): The start of authority record is a type of DNS record that contains information about DNS zone files, domain serial number, and especially regarding zone transfer, its format is specified in RFC 1035.

Conclusion

In this article, we conclude that the DNS types play an important role in a computer network; it is beneficial for anyone who is using the computer. The hostname is for human use and the IP address is for the machine attached in the network, DNS converting numeric IP addresses to hostname and back.

Recommended Articles

This is a guide to DNS Types. Here we also discuss the introduction and top 3 types of DNS along with an explanation. You may also have a look at the following articles to learn more –

  1. DNS Interview Question
  2. DHCP vs DNS
  3. DNS Amplification Attack
  4. Node.JS DNS

View Discussion

Improve Article

Save Article

Like Article

Prerequisite – Domain Name Server 
Mapping a domain name to an IP Address is known as Name-Address Resolution. The Domain Name Server (DNS) Resolver performs this operation by consulting name servers. 

In order to find a particular DNS requesting host place its query to the Local DNS Server with a mapping request. If it has the information, the resolver is satisfied else the resolver is referred to other servers or other servers are asked to provide the information. After the resolver, gets the response, it checks whether the response is correct or not. If the response is correct, the response is passed to the process that requested it, else the name query fails. 

A resolution can be of two types – iterative and recursive. 
 

1. Recursive Resolution – 
Here, the client requires the Local Server to give either the requested mapping or an error message. A DNS Query is generated by the application program to the resolver to fetch the destination IP Address. The Query is then forward to the local DNS Server. If it knows the IP Address, it sends a response to the resolver. Assuming, it does not know the IP Address, it sends the query to the root name server. 

The root name server contains information about at least one server of Top Level Domain. The query is then sent to the respective Top-Level Domain server. If it contains the mapping, the response is sent back to the root server and then to the host’s local server. If it doesn’t contain the mapping, it should contain the IP Address of the destination’s local DNS Server. The local DNS server knows the destination host’s IP Address. The information is then sent back to the top-level domain server, then to the root server and then to the host’s Local DNS Server, and finally to the host. 

2. Iterative Resolution – 
The main difference between iterative and recursive resolution is that here each server that does not know the mapping sends the IP Address of the next server to the one requested it. Here, the client allows the server to return the best answer it can give as a match or as a referral. A DNS Query is generated by the application program to the resolver to fetch the destination IP Address. The Query is then forward to the local DNS Server. Assuming, it does not know the IP Address, it sends the query to the root name server. 

The root name server returns the IP Address of the Top-Level Domain Server to the Local Server. The Top-Level Domain server is contacted by the Local Server and it returns either the IP of the destination host or its local DNS Server. If it returns the server’s address, then by contacting the destination’s Local DNS Server, we get the IP Address of the destination host. The response/mapping is then passed from the host’s local DNS server to the resolver and then finally to the host. 

Caching Mechanism – 
In both iterative and recursive resolution, after a server asks for a mapping request from another server, it receives the response and stores this information in the Cache memory before sending it to the client. This is done to lower the search time it takes for a server to check the IP Address in its Database. So, the next time, if a request comes to the server, it first checks its cache memory and tries to resolve the request. The response is marked as Unauthoritative to inform the client that the response is from Cache. The only way caching can be problematic is when the server caches the mapping for a long time and the mapping gets outdated. However, there are techniques to resolve this like using TTL.
 

Postingan terbaru

LIHAT SEMUA