Introduction
Computers route traffic using IP addresses, but humans remember names, not numbers. The Domain Name System (DNS) is the internet's distributed directory service: it maps domain names like example.com to IP addresses like 93.184.216.34, and back again. Without DNS, you would need to memorize numeric addresses for every website you visit.
Cricket analogy: Commentators call players by name like Kohli or Bumrah, but the scoreboard system tracks them by squad numbers; DNS is what lets you say 'example.com' while the network actually routes using the numeric jersey, the IP address.
Explanation
DNS is organized as a hierarchy, not a single database. At the top sit 13 sets of root servers, which know how to reach the servers responsible for top-level domains (TLDs) such as .com, .org, or .net. Below the TLD servers are authoritative name servers, which hold the actual records for specific domains such as example.com. A typical DNS lookup begins when your device asks a recursive resolver (often run by your ISP or a public service) to find the answer on its behalf. If the resolver does not already have the answer cached, it walks the hierarchy: it asks a root server which TLD server to contact, asks that TLD server which authoritative server handles the domain, and finally asks the authoritative server for the actual record. The resolver then returns the final answer to the client and typically caches it for future queries.
Cricket analogy: An ICC tournament works top-down: the ICC (root) points you to the BCCI (TLD) for Indian domestic matches, and BCCI points you to the specific team management (authoritative server) that holds the actual player records.
DNS stores different kinds of information using resource records. An A record maps a name to an IPv4 address; an AAAA record maps a name to an IPv6 address; a CNAME record is an alias pointing one name to another canonical name; an MX record specifies the mail servers responsible for accepting email for a domain, along with a priority; an NS record identifies the authoritative name servers for a domain; and a TXT record holds arbitrary text, commonly used for domain verification and email security policies such as SPF or DKIM.
Cricket analogy: A team's official record sheet has separate entries: batting average (A record), a discontinued fielding-position note aliasing to the current role (CNAME), the physio's contact details (MX-equivalent for injury reports), the club secretary listing (NS), and sponsor disclosure text (TXT) all stored side by side.
Example
# Query DNS records from the command line using dig
# Get the A record (IPv4 address) for a domain
dig example.com A
# Get the MX records (mail servers) for a domain
dig example.com MX
# Trace the full recursive resolution path, from root to authoritative
dig +trace example.comAnalysis
The dig +trace output shows exactly the hierarchical path described above: it starts at a root server, follows a referral to the .com TLD servers, and finally reaches the authoritative servers for example.com, which return the A record. This layered design lets DNS scale to billions of lookups a day, because no single server needs to know every domain in the world; each server only needs to know how to point toward the next level down. Caching at the recursive resolver (and even on your own device) is what makes repeated lookups feel instant after the first one.
Cricket analogy: A DRS review replay shows the exact chain of umpires consulted: on-field umpire to third umpire to ball-tracking technology, just as dig +trace shows the path from root to .com TLD to example.com's authoritative server, letting each level handle only its part.
Key Takeaways
- DNS resolution flow: client -> recursive resolver -> root server -> TLD server -> authoritative server -> answer returned to client (and cached).
- A record: maps a name to an IPv4 address. AAAA record: maps a name to an IPv6 address.
- CNAME record: aliases one name to another canonical name.
- MX record: specifies mail servers for a domain and their priority; NS record: lists a domain's authoritative name servers.
- TXT record: holds free-form text, often used for verification or email authentication policies like SPF/DKIM.
- DNS uses port 53, typically over UDP, falling back to TCP for larger responses.
Practice what you learned
1. In a full recursive DNS resolution, which server is contacted immediately after the root server?
2. Which DNS record type maps a domain name to an IPv6 address?
3. What is the purpose of an MX record?
4. Which entity does a client typically query first when resolving a domain name?
5. What is DNS's default port and typical transport protocol?
Was this page helpful?
You May Also Like
Application Layer Protocols Overview
A survey of the protocols that let applications talk to each other over a network, and how they fit above the transport layer.
HTTP and HTTPS
The request/response protocol behind the web, its core methods, and how TLS secures it as HTTPS.
IP Addressing and Subnetting
Master IPv4 addressing and CIDR subnetting with a fully worked, hand-verified example.
Ports and Sockets
Understand port number ranges and how a socket, the pairing of an IP address and port, identifies a network endpoint.
Network Troubleshooting Tools
Learn how ping, traceroute, netstat/ss, and nslookup/dig work under the hood to diagnose connectivity, routing, and DNS issues.