Skip to main content
TCP/IP Model Complete Guide
CHAPTER 09 Beginner

DNS – Domain Name System

Updated: May 15, 2026
20 min read

# CHAPTER 9

DNS – Domain Name System

1. Introduction

The Internet operates strictly on numbers. As we learned in Chapter 4, routers can only navigate using IP addresses (e.g., 142.250.190.46). However, the human brain is terrible at remembering strings of random numbers. If you had to memorize the IP address of every website you visit, the internet would be unusable. To bridge the gap between human memory and computer mathematics, engineers invented the Domain Name System (DNS). In this chapter, we will explore DNS—the global phonebook of the internet. We will trace the exact journey of a domain resolution and decipher the various DNS records used to configure web architecture.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Define the primary purpose of the Domain Name System (DNS).
  • Understand the step-by-step process of Recursive Domain Resolution.
  • Explain the role of the Root, TLD, and Authoritative Nameservers.
  • Differentiate between common DNS Records (A, CNAME, MX, TXT).
  • Use terminal tools (nslookup) to manually query DNS servers.

3. Beginner-friendly Explanations

The Global Phonebook: Imagine trying to call your friend "Alice". You don't know Alice's 10-digit phone number. You open your Contacts app, search for "Alice", and hit call. The app instantly translates the name "Alice" into 555-0199 and dials the number. DNS is the Contacts app for the Internet. When you type amazon.com into your browser, your computer pauses. It sends a lightning-fast request to a DNS Server asking: *"What is the IP address for amazon.com?"* The DNS server replies: *"It's 205.251.242.103."* Only then does your browser actually connect to the website.

4. The 4-Step DNS Lookup Journey

When you type a URL, the resolution process involves querying a hierarchy of highly specialized servers.
  1. 1. The Recursive Resolver: Your computer first asks your Internet Service Provider's DNS server (the Resolver). If the Resolver doesn't have the answer memorized in its cache, it goes searching on your behalf.
  1. 2. The Root Server: The Resolver asks one of the 13 global Root Servers. The Root Server acts as a librarian. It says, *"I don't know the exact IP, but I see it ends in .com. Go ask the .com server."*
  1. 3. The TLD (Top Level Domain) Server: The Resolver asks the .com TLD Server. The TLD server says, *"I don't know the exact IP, but I know the company who registered amazon.com. Go ask their specific Nameserver."*
  1. 4. The Authoritative Nameserver: The Resolver asks Amazon's dedicated Nameserver. This server holds the actual, final answer. It replies with the exact IP address. The Resolver gives it to your browser and saves it in its cache for next time.
*(This entire global interrogation happens in under 50 milliseconds!)*

5. DNS Records

When you buy a domain name (like mywebsite.com), you configure its Authoritative Nameserver using different types of text records.
  • A Record (Address): The most common. It points a domain name directly to an IPv4 address. (e.g., mywebsite.com -> 192.0.2.1).
  • AAAA Record: Same as an A Record, but points to an IPv6 address.
  • CNAME (Canonical Name): An alias. It points a domain to *another domain name*, not an IP. (e.g., www.mywebsite.com points to mywebsite.com). Useful if your IP changes frequently.
  • MX Record (Mail Exchange): Tells the internet which server handles emails ending in @mywebsite.com.
  • TXT Record (Text): Used to attach readable text notes to your domain, highly utilized for proving domain ownership and configuring email security (SPF/DKIM) to stop spam.

6. Command Examples

You do not need a browser to test DNS. You can interrogate DNS servers directly from your terminal using nslookup or dig.
bash
12345678
# Query the default DNS server for the IP of google.com
nslookup google.com

# The output will show the Server that answered you,
# and the "Non-authoritative answer" containing Google's IP addresses.

# (Linux/Mac) Advanced querying tool showing the exact query time
dig google.com

7. Best Practices

  • Lowering TTL before Migrations: DNS records have a TTL (Time To Live), which dictates how long other servers should cache the IP address (often 24 hours). If you are moving your website to a new server tomorrow, you must log into your DNS settings today and lower the TTL to 5 minutes. This ensures that when you change the IP address tomorrow, the entire internet updates instantly instead of sending users to the old server for 24 hours.

8. Common Mistakes

  • DNS Propagation Panic: Beginners change their website's A Record, immediately open their browser, and see the old website. They panic and break their server configuration. It takes time for the thousands of Recursive Resolvers around the globe to clear their caches and fetch the new IP address. This delay is called "DNS Propagation" and can take up to 48 hours globally. Be patient.

9. Mini Project: Change Your Computer's DNS Server

By default, your router uses your ISP's DNS servers. These can be slow or log your history. Let's switch to Cloudflare's blazing-fast, privacy-focused DNS.
  1. 1. Open your computer's Network/Wi-Fi settings.
  1. 2. Find the IPv4 settings and look for "DNS Server".
  1. 3. Change it from "Automatic" to "Manual".
  1. 4. Enter Cloudflare's Primary DNS: 1.1.1.1
  1. 5. Enter Cloudflare's Secondary DNS: 1.0.0.1
  1. 6. Save. Your internet browsing will likely feel noticeably snappier because domain resolution is happening faster!

10. Practice Exercises

  1. 1. If you want to route all emails sent to contact@yourstartup.com to Google Workspace, which specific DNS record type must you configure?
  1. 2. Explain the purpose of a CNAME record. Why wouldn't you just use an A record for everything?

11. MCQs with Answers

Question 1

Which DNS server holds the final, official DNS records for a specific domain name?

Question 2

Which DNS record type maps a domain name directly to an IPv4 address?

12. Interview Questions

  • Q: Explain the step-by-step resolution process that occurs when a user types a URL into their browser.
  • Q: Differentiate between an A Record and a CNAME record. In what architectural scenario would a CNAME be required?
  • Q: What is "DNS Propagation" and why does it cause delays during server migrations?

13. FAQs

Q: Can the internet break if DNS goes down? A: Yes! In 2016, a massive DDoS attack took down Dyn, a major DNS provider. As a result, Twitter, Netflix, and Reddit went offline for half of America. The servers were fine, but because DNS was broken, no one's browser could translate the names into IP addresses to find them!

14. Summary

In Chapter 9, we explored the Domain Name System, the critical translation layer that maps human-readable domains to mathematical IP addresses. We traced the hierarchical, millisecond journey of a DNS query from the local Resolver up to the Authoritative Nameservers. We cataloged the essential DNS records—A, CNAME, MX, and TXT—providing the configuration knowledge required to launch websites and route enterprise email. Finally, we recognized the power of tools like nslookup to diagnose propagation issues, proving that mastering DNS is a non-negotiable skill for modern web architecture.

15. Next Chapter Recommendation

DNS found the IP address. Now, the browser must use that IP address to actually ask the server for the webpage data. Proceed to Chapter 10: HTTP and HTTPS Fundamentals.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·