written 2.7 years ago by |
Domain Name System (DNS) is the phonebook of the Internet. Humans access information online through domain names. DNS translates domain names to IP addresses so browsers can load Internet resources.
Each device connected to the Internet has a unique IP address which other machines use to find the device. DNS servers eliminate the need for humans to memorize IP addresses.
When a user tries to access any web address their web browser or application performs a DNS Query against a DNS server, supplying the hostname. The DNS server takes the hostname and resolves it into a numeric IP address, which the web browser can connect to.
There are three types of query resolution in DNS:
- Recursive query:
In a recursive query, a DNS client requires that a DNS server (mostly a DNS recursive resolver) will respond to the client with either the requested resource record or an error message if the resolver can't find the record. The resolver starts a recursive query process, starting from the DNS Root Server, until it finds the Authoritative Name Server that holds the IP address and other information for the requested hostname.
Iterative Query: In Iterative Query the DNS client will allow a DNS server to return the best answer it can. If the DNS resolver has the relevant DNS records in its cache, it returns them. If not, it refers the DNS client to the Root Server, or another Authoritative Name Server which is nearest to the required DNS zone. This process continues with other DNS servers down the query chain until either an error or timeout occurs.
Non-recursive query: It is a query in which the DNS Resolver already knows the answer. It immediately returns a DNS record because it already stores it in local cache, or queries a DNS Name Server which is authoritative for the record, meaning it definitely holds the correct IP for that hostname. In Non-recursive query a response is immediately returned to the client.