← Back to Home
🌐

DNS — How Names Become Addresses

The internet's phone book, and why 'it's always DNS' is a running joke in operations.

9 min read📚DevOps Fundamentals

You type github.com, not 140.82.121.3. DNS (the Domain Name System) is the service that translates names people remember into IP addresses machines use. When it misbehaves, half the internet looks broken — hence the DevOps meme, “It’s always DNS.”


🎯 Learning Objectives

By the end of this lesson you will:


Why DNS Exists

IP addresses change, and nobody wants to memorise numbers. DNS gives us a stable, human-friendly name that points to whatever IP is current. Change servers? Update the DNS record — the name stays the same.

💡 The one-line version

DNS is the internet’s phone book: you look up a name and get back an address.


How a Lookup Works

When you request www.example.com, your computer asks a chain of servers until it gets an answer:

text
You → Resolver → Root server → .com server → example.com server → IP!
  1. Resolver (usually your ISP or a public one like 8.8.8.8) receives the query.
  2. It asks a root server: “who handles .com?”
  3. The .com server replies: “ask example.com’s nameserver.”
  4. The authoritative nameserver returns the actual IP.
  5. The resolver caches the answer and hands it back to you.

All of this usually happens in a few milliseconds.


Common Record Types

Record Purpose Example
A Name → IPv4 address example.com → 93.184.216.34
AAAA Name → IPv6 address example.com → 2606:2800:...
CNAME Alias one name to another www → example.com
MX Where email is delivered mail.example.com
TXT Free-form text (SPF, verification) "v=spf1 ..."
NS Which nameservers are authoritative ns1.example.com

⚠ CNAME gotcha

A CNAME can’t sit at the root of a domain (example.com itself) alongside other records. That’s a classic real-world mistake — use an A record or your provider’s “ALIAS/ANAME” instead.


TTL and Caching

Every DNS record carries a TTL (Time To Live) — how many seconds resolvers may cache the answer before asking again.

💡 Planning a migration

Before moving a service to a new IP, lower the TTL a day in advance. Then when you switch, the change propagates in minutes instead of hours.


See It Yourself

Use dig to inspect DNS directly:

bash
dig github.com            # full lookup
dig github.com +short     # just the answer
dig MX gmail.com +short   # mail servers
bash — 80×24
student@devops:~$dig github.com +short
bash — 80×24
student@devops:~$dig MX google.com +short

🧪 Hands-on Lab

📝

Investigate a Domain's DNS

  1. Find the A record (IPv4) for a website you use
  2. Look up its MX records to see where its email goes
  3. Check the TTL on the A record

🧠 Knowledge Check

Knowledge Check

What does an A record do?

Knowledge Check

You need a DNS change to take effect quickly during a migration. What should you do beforehand?


💼 Interview Preparation

Interview Q&A

Why do people joke that 'it's always DNS'?


Summary

You now understand how DNS resolves names to addresses, the key record types (A, AAAA, CNAME, MX, TXT, NS), and how TTL controls caching and propagation. Next, we’ll look at HTTP — the protocol your apps actually speak — and how load balancers spread traffic across servers.

Up Next

HTTP & Load Balancing

You've mastered this lesson. Continue your journey to becoming a DevOps Engineer.

Start Next Lesson