Domain Name System
The Domain Name System (DNS): Theory and Architecture
Introduction to DNS
In the vast landscape of the internet, humans and computers speak different languages regarding location. While people rely on easy-to-remember hostnames (like www.google.com), computers communicate using numerical IP addresses. The Domain Name System (DNS) is the critical infrastructure responsible for bridging this gap by translating hostnames into IP addresses.
DNS is not a single, isolated program. Instead, it operates as a sophisticated application-layer protocol that allows hosts to query a massive database. To handle the scale of the entire internet, this database is not stored on one computer; rather, it is a distributed database implemented across a global hierarchy of servers.
The Distributed, Hierarchical Architecture
If every computer on earth queried a single server for website addresses, that server would crash instantly. To solve this, DNS is distributed globally across many servers to ensure scalability.
These servers are organized in a hierarchical fashion. This structure ensures that no single server needs to know every domain name; instead, they know who to ask next, creating an efficient path to resolution.
The Hierarchy of DNS Servers
The DNS hierarchy functions like a global directory assistance service, categorized into three distinct classes:
Root DNS Servers: At the very top of the hierarchy sit the Root Servers. These are the starting point for resolving a domain name. When a request comes in, these servers direct queries to the appropriate Top-Level Domain (TLD) servers. There are 13 root server clusters strategically located worldwide to handle this foundational traffic.
Top-Level Domain (TLD) DNS Servers: Sitting just below the root are the TLD servers. These servers are responsible for managing specific domain extensions, such as
.com,.org, and.net. They do not provide the final IP address but instead forward the query to the specific server that handles the requested domain.Authoritative DNS Servers: At the end of the chain are the Authoritative servers. These servers maintain the specific records for a domain (e.g.,
example.com). When the query finally reaches this level, the authoritative server provides the final IP address resolution.
How Queries are Resolved
When a client needs to find an IP address, the DNS servers can communicate in two distinct ways to find the answer:
- Recursive DNS: In this approach, the server takes full responsibility for the client's request. It essentially says, "Wait here, I'll find it for you." It queries other DNS servers on behalf of the client until it returns with a definitive answer.
- Iterative DNS: In this method, the server acts more like a guide. It provides the best answer it currently has but may refer the client to a different server. The client is then responsible for following up on that referral to continue the search.
The Building Blocks: DNS Resource Records (RRs)
The actual data stored within these DNS servers are known as Resource Records (RRs). These records provide the essential hostname-to-IP mappings. Every resource record is structured with four specific fields:
- Name: The actual domain name in question (e.g.,
www.example.com). - Value: The data associated with that name, which could be an IP address or another domain name, depending on the record type.
- Type: A designation specifying what kind of DNS record it is.
- TTL (Time-To-Live): A duration that determines how long the record remains valid before it must be refreshed.
Common Record Types
Different situations require different types of records stored in the database:
- A (Address Record): This is the standard record that maps a hostname directly to its IP address.
- NS (Name Server Record): This record delegates authority, specifying the authoritative name server for a specific domain.
- CNAME (Canonical Name Record): This functions as an alias, mapping one domain name to another "canonical" or true domain name.