What is a DNS?
DNS simplified for software developers looking to have a fundamental understanding of how the web works.
At the time of writing this article, it is the new year. I would like to wish my readers a Happy New Year! I would like to start this article with a little bit of inspiration on why I decided to write this article - feel free to skip to the next section.
Inspiration
I recently found myself researching about subdomains and how they can help organize website content more effectively. As I explored further, I realized that we often take certain engineering decisions for granted, rarely questioning the hidden complexities and design choices that make modern systems function so seamlessly. DNS (Domain Name System) is a perfect example—despite being invented in the 1980s, we rarely stop to question how entering a simple URL like davidalex.ca
renders into a webpage in our browser.
In this article, I’ll share what I’ve learned about DNS, how it works behind the scenes, and why it remains a fundamental part of the internet today.
What is DNS and why do we need it?
DNS (Domain Name System) in simple terms, is a directory of addresses that map simple (human-friendly) hostname to an IPv4 or IPv6 (machine-friendly) address. It eliminates the needs for users to memorize long IPv4 or IPv6 addresses that devices use to communicate.
From a user’s point of view, they simply need to enter a URL in the browser, and the DNS server is responsible for finding the IP address that is mapped to the hostname. Once the address is resolved, the browser receives the address and is able to find the requested resource.
DNS servers resolve at incredible speeds behind the scenes. It is important that we understand and appreciate the engineering behind domain name resolution.
What are the key components in a DNS?
There are four main subsystems in a DNS are :-
Recursive resolver
Root servers
Top Level Domain (TLD) servers
Authoritative Name servers (Name servers)
How does it work?
User makes a request from their browser for
example.com
. The request travels through the internet to the DNS.The resolver receives the requests and begins by making a request to the root servers.
The root servers are responsible for identifying the TLD (i.e.
.com
) and returning a list of servers for the.com
domain.The resolver makes a request to the
.com
server (TLD server).The server returns with a list of authoritative name servers.
The resolver makes a request to the authoritative name servers that hold the DNS records for the requested domain.
The name servers return the IP address of the requested domain.
The IP address is returned to browser and a HTTP request can now be made to the server and the requested resource is returned to the user.
Conclusion
DNS is a complex yet fundamental system that translates human-readable URLs into machine-readable IPv4 or IPv6 addresses. The resolver server plays a crucial role in this process, making requests to the root, TLD, and authoritative name servers to retrieve the final IP address of a requested domain.
Once the IP address is found, the browser can connect to the server and fetch the requested resource, enabling seamless web access.
Note: This article focused on the core concepts of DNS resolution, leaving out details on caching, load balancing, and failure handling, which add even more complexity to the system.
I hope this article has helped you gain a clearer understanding—and perhaps a greater appreciation—of this essential piece of web infrastructure.