Domain Name System (DNS) and How It Works
go backGo back

Domain Name System (DNS) and How It Works

Published on Mar 27 2022

Last updated on Apr 23 2024

photo-1601737062317-b16d38140485
No translation available.
Add translation

Thanks to Domain Name System (DNS), users around the globe can access the internet easier without the need to remember the long IP addresses of their favorite websites.

What is Domain Name System?

For a browser on a computer to go to a website, it needs an IP address of the server where the website lives on. Those IP addresses generally look like this:

142.251.33.110 (IPv4) or 2607:f8b0:4004:813::200e (IPv6)

It probably doesn't look familiar but you use those addresses almost every day. Those are the IP addresses of google.com and I can't remember that and neither can you (probably). In fact, the average person can only remember about 7 digits in their working memory at any given time! So, how can anyone remember any IP address?

To solve this problem, the Domain Name System translates a domain name to an IP address. So now anyone can go to google.com without memorizing its IP address.

How DNS Works

In short, when you put in a URL or a domain name in the browser, your browser make a DNS query. Once your browser able to find the corresponding IP, it will use that address to retrieve the data of the websites (files and content). Below is the complete picture illustrated by Julia Evan (She is my favorite blogger/software developer).

How DNS works explained by Julia EvansIllustration by Julia Evans

Wait, but what is a DNS query?

Let's take a deeper look into the concept of a DNS query. When you type in a web address into your browser, it will attempt to do the following steps:

  1. The browser will first look into the cached IP addresses inside your computer (a.k.a the recursive resolver or their local memory). If you're visiting a website that you've been to recently, this is where the query stops.

  2. If your browser doesn't recognize the domain name, which means there is no matching IP address to that domain name in the local memory, the resolver will ask an authoritative nameserver.

  3. Now, if the first nameserver you ask does know, then the DNS query is complete. However, if the root nameserver does not know, it will tell the resolver to go ask another authoritative nameserver, and the cycle goes on until the resolver finds the matching IP address.

Life of a DNS query explained by Julia EvansIllustration by Julia Evans

How long is it gonna take?

The amazing part about DNS query is that this whole process happens extremely quick, in a split second, the browser is able to query, locate, and deliver a website to your eyes!

Conclusion

To summarize, DNS is the system that maps URLs with their IP address. DNS allows people to look up websites using human-friendly and easy to remember names. Without DNS, we would have to look through a phonebook contains long strings of IP addresses whenever we want to visit a website. Yay DNS!

Tags:
hosting
My portrait picture

Written by Alissa Nguyen

Alissa Nguyen is a software engineer with main focus is on building better software with latest technologies and frameworks such as Remix, React, and TailwindCSS. She is currently working on some side projects, exploring her hobbies, and living with her two kitties.

Learn more about me


If you found this article helpful.

You will love these ones as well.

  • photo-1560790671-b76ca4de55ef
    Apr 23 2024 — 5 min readA Beginner's Introduction to Domain Names
    #hosting
  • Photo by NASA
    Apr 23 2024 — 5 min readWeb Development Explained: How the Web Works
    #hosting#html
  • Photo by Sereja Ris
    Apr 23 2024 — 5 min readIntroduction to Web Hosting
    #hosting

  • Built and designed by Alissa Nguyen a.k.a Tam Nguyen.

    Copyright © 2024 All Rights Reserved.