DNS magic and Internal

DNS magic and Internal

Article Topics

  1. What is DNS and why it is important ?

  2. Types of DNS Records: You should Know

  3. DNS hierarchy Explained: Root to Authoritative servers


  1. What is DNS and why it is important ?

DNS :-

→ DNS stands for Domain Name System. It acts like a phonebook for the IP addresses of all domain names on the internet.

→ It helps us to find websites by translating easy-to-remember names (like www.example.com) into the numerical IP addresses (like 192.0.2.1) that computers use to locate each other on the internet.

→ DNS is an application layer protocol for message exchange between clients and servers.

→ 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 such as 192.168.1.1 (in IPv4), or more complex newer alphanumeric IP addresses such as 2400:cb00:2048:1::c629:d7a2 (in IPv6).

The Role of DNS in Web Hosting and Domain Management:-

The Domain Name System (DNS) is often compared to a phonebook for the internet. It translates user-friendly domain names (like xyz.com) into machine-readable IP addresses (e.g., 192.0.2.1) so that users don’t need to remember numerical sequences. DNS ensures that when a user types in a domain name, they are routed to the correct server hosting the website.

Static vs. Dynamic Characteristics

  1. Domain Names (Static):
    Domain names are fixed and remain consistent regardless of where the website is hosted. They serve as a reliable identifier for users to access your site.

  2. IP Addresses (Dynamic):
    IP addresses, on the other hand, can change when you switch hosting providers or reconfigure your server. This is because different hosting services assign their own IP addresses to websites hosted on their infrastructure.

Practical Example: Switching Hosting Providers

Imagine you own a website with the domain xyz.com and initially host it on AWS. You pay a fee to AWS for hosting services. However, if AWS increases its prices, you might decide to move your website to another hosting provider, such as GoDaddy.

  • Scenario 1:

    • Website is hosted on AWS, with an assigned IP address, e.g., 3.4.5.6.

    • DNS records for xyz.com are configured to point to this IP.

  • Scenario 2:

    • You switch to GoDaddy for hosting, where a new IP address, e.g., 7.8.9.10, is assigned.

    • You update the DNS records for xyz.com to reflect the new IP address.


  1. DNS hierarchy Explained: Root to Authoritative servers

When a browser requests the IP address of a specific domain, the following steps occur:

step 1:- User Enters the Domain name:-

Example:- The process begins when a user enters chaicode.com in their web browser or clicks on a link.

step-2:- Browser Checks Cache:-

The browser first checks its local cache to see if it has a recently resolved IP address for the domain.

  • If Found: The browser directly uses this IP to send the request to the server.

  • If Not Found: The browser initiates a DNS query to resolve the domain.

step-3 :- Operating System Cache:-

If the browser cache misses, the query is passed to the operating system, which maintains its own DNS cache.

  • If Found: The system returns the cached IP address.

  • If Not Found: The query is forwarded to the next level.

step-4 :- Querying the Recursive Resolver

The request is sent to a DNS Recursive Resolver provided by the user's Internet Service Provider (ISP) or a third-party resolver (e.g., Google DNS at 8.8.8.8 or Cloudflare DNS at 1.1.1.1).

step-5:- Recursive Lookup by Resolver

The resolver checks its cache for the domain's IP address.

  • If Found: It sends the IP address back to the browser.

  • If Not Found: The resolver starts a recursive query to find the IP address by contacting authoritative DNS servers.

step-6:- Iterative Query Process

The resolver performs the following steps iteratively:

  1. Contact the Root DNS Server:
    The resolver sends a query to one of the 13 root DNS servers to find the Top-Level Domain (TLD) server for the domain (e.g., .com for example.com).

    • The root server responds with the address of the TLD server.
  2. Contact the TLD DNS Server:
    The resolver queries the TLD server for the Authoritative Name Server of the domain.

    • For example.com, the .com TLD server responds with the address of the authoritative name server for example.com.
  3. Contact the Authoritative Name Server:
    The resolver queries the authoritative server for the IP address of the domain.

    • The authoritative server responds with the IP address (e.g., 93.184.216.34 for example.com).

step-7 :- IP Address Returned to the Browser

The resolver sends the resolved IP address back to the browser. The browser can now use this IP address to initiate a connection to the web server hosting the website.