The Magic Behind the Web: A Simple Guide to DNS

Jaspreet Singh Sodhi
2 min readJul 28, 2024

--

What is DNS?

DNS (Domain Name System) is like the internet’s phonebook. Instead of using IP addresses (like phone numbers), we use domain names (like nytimes.com) to visit websites. DNS translates these easy-to-remember domain names into IP addresses, so our browsers can load the websites.

How DNS Works

When you type a website address in your browser, DNS converts it into an IP address through a process called DNS resolution. Here’s a simplified breakdown:

  1. DNS Recursor: Acts like a librarian fetching a book for you. It receives your request and searches for the answer.
  2. Root Nameserver: The first step, like an index in a library, pointing to where more specific information is stored.
  3. TLD Nameserver: Points to specific racks of books (domains like .com, .net).
  4. Authoritative Nameserver: The final stop that has the exact IP address you need.

Types of DNS Servers

  • Recursive DNS Resolver: Starts the search process and keeps looking until it finds the answer or fails.
  • Authoritative DNS Server: Holds and provides the final answer for the domain’s IP address.

DNS Lookup Process

  1. You type a domain (example.com) into your browser.
  2. The query goes to a DNS recursive resolver.
  3. The resolver asks a root nameserver for the TLD server’s address (.com).
  4. The resolver then queries the TLD server, which directs it to the domain’s authoritative nameserver.
  5. The authoritative nameserver provides the IP address for the domain.
  6. The resolver returns the IP address to your browser.
  7. Your browser uses the IP address to load the website.

DNS Queries Types

  1. Recursive Query: The resolver keeps searching until it finds the answer or an error.
  2. Iterative Query: The resolver returns the best answer it has and refers to another server if needed.
  3. Non-recursive Query: If the resolver already has the answer in its cache, it responds immediately.

DNS Caching

Caching temporarily stores data to improve speed and reliability. DNS records can be cached at different levels:

  • Browser Cache: Stores DNS records for quick access.
  • Operating System Cache: Handles DNS requests within your computer before reaching the internet.
  • ISP Resolver Cache: Your Internet Service Provider’s resolver also caches DNS records to speed up the process.

By understanding DNS, we can see how it efficiently translates domain names into IP addresses, making our internet experience smoother and faster.

That’s it!. Feel free to follow me and share your thoughts on what else I can improve.

Do checkout the my complete ongoing series on System Design —

jaspreetsodhi02.medium.com/list/system-design-series-f5054fed26fd

See you in the next part! 😊

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Jaspreet Singh Sodhi
Jaspreet Singh Sodhi

Written by Jaspreet Singh Sodhi

Full Stack Software Engineer | Curating Top-Notch Content @jaspreet.dev on Instagram ✨

No responses yet

Write a response