Before diving into the ocean of DNS , lets look at what DNS is:
DNS → Its like the phonebook of the Internet.
- Examples of DNS: google.com, hashnode.com or linkedin.com etc
Every Instance/Server has an IP Address
DNS translates domain names to IP Addresses.
How do IP Addresses look?
IPV4 → 192.154.2.1
IPV6 → 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Internals when we type some domain name into the browser:
Explanation of the Above Image:
DNS Recursor: It is the main server that makes recursive calls to get the IP Address ( can be thought like a librarian)
- It makes calls to Root NameServer, TLD NameServer and Authoritative NameServer recursively.
Root NameServer: First step in translating human readable hostnames, It specifically points out the address of TLD NameServer for further processing .
Ex: It gives the address of the .com/.net/.in servers.
TLD NameServer: Top Level Domain NameServer is responsible for giving the address of the Authoritative NameServer.
Ex: It gives the address of the google.com servers.
Authoritative NameServer: This is the final nameserver in the DNS lookup process. It holds the actual DNS records for a specific domain, including the IP address associated with the domain name.
DNS Queries:
Recursive Query: In simple terms, a recursive query is like asking a librarian to find a book for you, and they keep searching until they find it or confirm it doesn't exist. For a recursive Query the resolver either returns an IP Address for the query or an error message if it wasnt able to find the IP Address for the asked record.
Iterative Query: Allows best possible answer, with referrals to other servers.
An iterative query is like asking for directions, where each person you ask points you to someone else who might know better.
Basically in an iterative query if the Server wasnt able to find the IP address for the requested record, then it gives the address for the other server, then resolver makes call to that given server …and so on, this process continues until there is a record found or returns an error message.
Non-Recursive Query: Queries for records the server has direct access to.
Its like asking a librarian for a book, but only if it's on their desk or in their immediate memory.
DNS resolver client queries a DNS server for a record that it has access to either because it's authoritative Server for the record or the record exists inside of its cache.
Typically, a DNS server will cache DNS records to prevent additional bandwidth consumption and load on upstream servers.
DNS Caching:
Occurs at multiple levels: browser, operating system, and ISP (Internet Service Provider Ex: JIO/AIRTEL/ACT FIBERNET).
Improves performance by storing DNS records closer to the requesting client.
Complete Flow:
References:
https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains
https://www.godaddy.com/resources/skills/most-common-domain-extensions
Want to learn more? go for these: