You can understand the DNS (Domain name system) as the phonebook of the internet. Every URL have an IP address associated with them when you type a URL of any website on your browser, DNS changes the URL into IP address of the Web server associated with that URL. Without DNS you will need to enter the IP address to reach any website. When you enter a Domain name to open a website, DNS sends the query to the internet to match the domain name with its associated IP address.
To explain DNS in a technical way, DNS (Domain name system) is a hierarchical structure which is used to find the exact IP of your requested website to scan across the network of millions of IP addresses. Most of the internet activity depends on DNS (Domain name system) to provide quickly the information required to connect users to remote hosts.
How Does DNS Work
Everything that is connected to the Internet has an IP address whether it is the mobile, website, Google Home, or computer. Every internet-connected device has a unique IP address, by the unique IP address devices identifies each digital device to communicate via the world wide web. Thanks to DNS we don’t have to remember the IP addresses of everything that is connected to the internet.
When a person enters the domain name of the website to open that website DNS locate that name and searches the IP address associated with that domain name and then change the domain name into IP address.
What is Recursive DNS servers and Authoritative DNS servers?
When you search domain then your computer sends a request to recursive DNS server to find the IP address associated with that domain name. Basically, the recursive DNS server is a computer which responds to a request from client computers to track down the DNS record. Recursive DNS server is also known as a recursive resolver
The Authoritative DNS server is a server which has DNS record and allows the browser to fulfil the request of a client computer. This is the last server in the DNS lookup chain which respond with the queried resource record. This server has the capability to satisfy queries from its own data because it holds the DNS record.
Understanding the DNS structure
A domain contains multiple parts, knowns as labels. Each portion of domain name denotes subdivision to its right side of the portion. After the domain like .com, .org and .edu are the top-level domain in the domain name. Every label to the left indicates another subdomain on the right. To understand it in a more easy way suppose there is a domain name “www.example.com”. In this domain name “www.” is a subdomain of “example” and “example” is a subdomain of “.com”. In the DNS structure there can up to 127 levels of subdomains and every label can contain 63 characters. The length of every domain character can be up to 253 characters.
Types DNS query
There are mainly three types of DNS query Recursive query, Iterative query, and Non-recursive query.
In the Recursive query, the client sends the query and DNS server response with the requested resource record. If the server is unable to find the match for the requested domain name in the record then it responds with an error message.
Unlike the recursive query in the iterative query, the DNS client allows the DNS server to return the best answer it can. If the server can’t find the match for a requested domain name then a referral to the DNS server that is authoritative for a lower domain namespace level will be returned. A query is then made to the referral address by the DNS client. Till there is either an error or a timeout this process will continue with additional DNS servers.
This query takes place when a DNS resolver client requests for a record which has access to DNS server, either because the record is inside its cache or because it is authoritative for the record.