DEV Community

Cover image for The Journey of DNS Resolution: How the Internet Finds Websites for You
Umair Syed
Umair Syed

Posted on

The Journey of DNS Resolution: How the Internet Finds Websites for You

Imagine you’re in a big city, trying to visit a building. Instead of using an address like 123 Main Street you just remember the name of the building, like Google Headquarters To find this building, you need someone to convert the name into an actual address. In the same way, websites have IP addresses (like 192.168.1.1) that are needed for your computer to find them. Every device on the internet, including websites, has its own unique IP address. Without these addresses, your computer wouldn’t know where to send or receive information, and websites wouldn’t be able to load. That’s exactly what DNS (Domain Name System) does for websites—it turns easy-to-remember names into IP addresses so your computer can find the right website. This process is called DNS resolution, where the system works behind the scenes to translate a website's name (like "google.com") into the numerical IP address needed to load the site on your browser.

Let’s learn how DNS works step-by-step, so by the end, you’ll know exactly what happens when you type a website name and hit "Enter."

How DNS Resolution Works

You Type a Website Name (URL):

You open your browser and type in “example.com” Before the page can load, your computer needs to know the IP address for "example.com"—the exact location on the internet.

Step 1: The Recursive DNS Resolver

The recursive DNS resolver is responsible for finding the correct IP address for the website you want to visit. It does this by asking different servers until it gets an answer.
Your computer asks for help from a recursive DNS resolver. This is like your internet assistant, and it’s usually provided by your internet service provider (ISP). If the resolver has seen the website before, it may have the IP address stored already. If not, it begins asking other servers to help find the IP address.

Step 2: The Root Name Server

The root name server is the first step in the DNS process. It works like a guide, directing the resolver to the right place based on the website's ending, like .com or .org.
The recursive resolver doesn’t know the IP address itself, so its first stop is the root name server. Think of the root server as a giant directory that knows where to find information for any website in the world. However, the root server doesn’t know the exact address for "example.com." Instead, it points the resolver to the next step: the Top-Level Domain (TLD) server.

Step 3: The TLD Name Server

The TLD name server is responsible for handling domain names that end with specific extensions, like ".com" or ".org." It points the resolver to the authoritative name server for that particular domain.
The recursive resolver goes to the Top-Level Domain (TLD) server. TLD servers are organized by the end of the website’s name, such as “.com,” “.org,” or “.net.” Since you are looking for "example.com", the resolver goes to the .com TLD server. This server knows which authoritative name server to ask for the exact IP address.

Step 4: The Authoritative Name Server

The authoritative name server holds all the information about a domain, including its IP address. It gives the resolver the final answer it needs to direct you to the right website.
Finally, the recursive resolver arrives at the authoritative name server. This server holds the DNS records for "example.com". DNS records are like stored information about your domain—things like its IP address, mail server details, and more. The authoritative server looks up the IP address for "example.com" and gives it to the resolver.

  • How Your Domain's DNS Records Are Accessed: When you register a domain and set up its DNS records, you are storing these records in the authoritative name server for that domain. So, if you own “mywebsite.com”, the IP address and other important details are saved in the authoritative server. Whenever someone tries to visit “mywebsite.com”, their recursive resolver will eventually ask your authoritative server for the IP address.

Step 5: The IP Address Is Returned

Now that the recursive resolver has the correct IP address, it sends it back to your computer. Your browser uses this address to connect to the website, and "example.com" loads on your screen.

Image description

DNS Caching: Speeding Things Up

You might think that going through all these steps every time would take a long time, but in reality, it happens very quickly—usually in milliseconds. This is because of something called DNS caching. Your computer, browser, and even the recursive resolver can store the IP addresses of websites for a certain amount of time. This means they don’t have to go through the whole process each time you visit a website. Instead, they can skip straight to the answer.

How your DNS records are pushed to Authoritative Name Server?

When you set up DNS records for your domain (such as the IP address, email server details, etc.), the process typically involves using your domain registrar or a DNS hosting provider. Here's how your DNS records are pushed to the authoritative name server:

  1. Register Your Domain: The first step is to buy a domain (like "example.com") from a domain registrar.

  2. Set Up DNS Records: Most domain registrars provide a control panel where you can manage your DNS records, or you can use a DNS hosting provider like Cloudflare or AWS Route 53 to manage your records. These records include details like the IP address (A record) of your website.

  3. Push to Authoritative Servers: Once you save your DNS records with the registrar or DNS hosting service, they automatically push these records to their authoritative name servers. These are the servers that answer DNS queries for your domain.

  4. Propagation: After you update or set up new DNS records, it may take some time for the changes to spread across the internet. This is called DNS propagation, where all the DNS servers around the world update their cached information to reflect your changes.

Wrapping It All Up

DNS resolution might seem like a lot of steps, but it’s a fast and efficient process that happens every time you visit a website. Whether you’re typing in "google.com" or "mywebsite.com", the DNS works behind the scenes to find the correct IP address, so your browser knows where to go.

Top comments (0)