The Domain Name System

Decoding the DNS Resolution (Lookup) Process


DNS Lifecycle

DNS TL;DR

  • DNS resolves domain names to IP addresses.
    • 👉 sergiopichardo.com to 18.156.208.118
  • DNS works like a phone book, first you look up a name, and it will give you a number.
  • In this case, an IP address that a client can use to connect to a server.

Key Concepts

Resolver Server

Resolver servers, also known as recursive DNS servers, play a crucial intermediary role in the Domain Name System (DNS). Typically provided by Internet Service Providers (ISPs) or public DNS services like Google's 8.8.8.8, these servers act as the first point of contact for client devices seeking to translate domain names into IP addresses. Resolver servers perform recursive queries on behalf of clients, traversing the DNS hierarchy to find the requested information. They also maintain a cache of recent queries, which significantly improves response times for frequently accessed domains. By handling the complexities of DNS resolution, resolver servers simplify the process for end-users and reduce the load on authoritative servers.

Root Server

At the top of the DNS hierarchy sit the Root servers, a critical component of internet infrastructure. There are 13 logical root servers, labeled A through M, which are physically implemented as hundreds of servers distributed worldwide. Operated by 12 different organizations and managed by the Internet Assigned Numbers Authority (IANA), root servers don't store specific domain information. Instead, they serve as a directory for Top-Level Domains (TLDs), directing queries to the appropriate TLD servers. This design ensures that even if a resolver has no cached information about a domain, it can always start the resolution process from the top of the hierarchy.

Authoritative Name Server

Authoritative Name Servers represent the final authority for specific domains in the DNS hierarchy. These servers store the actual DNS records for domains, including IP addresses (A and AAAA records), mail server information (MX records), and other domain-related data. Typically managed by domain registrars, hosting companies, or the domain owners themselves, authoritative name servers can be configured as primary (master) or secondary (slave) for redundancy. When queried for a specific domain, these servers provide the definitive answer, allowing domain owners to control how their domain names resolve and what services are associated with them.

DNS Resolution Process

DNS Lifecycle

  1. Client checks DNS cache: The client first looks in its local DNS cache to see if it already has the IP address for the domain (e.g. sergiopichardo.com) stored from a previous lookup.

  2. Client queries Resolver Server: If the IP address isn't in the local cache, the client sends a request to the Resolver Server (usually provided by the ISP) to resolve the domain name.

  3. Resolver Server checks its own DNS cache: The Resolver Server looks in its own cache to see if it has recently resolved this domain name.

  4. Resolver Server queries Root Server: If the Resolver Server doesn't have the information cached, it starts at the top of the DNS hierarchy by querying a Root Server.

  5. Root Server responds: If the Root Server doesn't know the specific IP address, it will respond with the address of the Top-Level Domain (TLD) server responsible for ".com" domains.

  6. Resolver server queries TLD Server: The Resolver Server then sends a query to the TLD Server for ".com" domains.

  7. TLD Server responds: The TLD Server responds with the IP address of the Authoritative Name Server that has DNS info about the sergiopichardo.com.

  8. Resolver server queries Authoritative Name Server: After getting the TLD Server IP address, the Resolver Server queries the Authoritative Name Server for the specific IP address of sergiopichardo.com.

  9. Authoritative Name Server responds: The Authoritative Name Server responds with the IP address for sergiopichardo.com, which is 18.156.208.118.

  10. Resolver Server sends IP to client: The Resolver Server sends the IP address back to the client and caches it for future use.

  11. The Client queries 18.156.208.118: With the IP address now known, the client sends an HTTP request directly to 18.156.208.118.

  12. The server at 18.156.208.118 responds: The web server hosting sergiopichardo.com responds to the client's request with an HTML document.

  13. The browser renders the HTML: Here's where the TLS and TCP handshake would happen and then the client's web browser receives the HTML document and renders it, displaying the website to the user.

Conclusion

In conclusion, DNS translates domain names into IP addresses, enabling users to connect to websites. The process involves resolver servers querying root and authoritative name servers to retrieve the correct IP address. This system simplifies internet navigation for users, ensuring efficient and reliable access to websites.