DNS is not just "turn a name into an IP"
The canonical example of DNS is looking up a name like www.example.com to get an IP address. But if you let your understanding end there, you hit problems in real work. DNS is more broadly "a distributed database where you ask what kind of information for this name is officially held by whom."
For example, you look up A / AAAA for the web, MX for mail delivery, and TXT for ownership verification. In other words, DNS always handles a name and a kind of question together as a pair.
www.example.com0 / 5 correct. Correctness is stored only in this browser's localStorage.
Practice 1-1 — Start from "name + type"
Confirm what a DNS question is built from.
Q1. When a browser wants to know the IPv4 address of www.example.com, which is the most correct DNS question?
Show hint
DNS queries consist of a "name" and a "type." Remember which type represents IPv4.
Q5. To check both A and AAAA for a single name, what is the minimum number of distinct query types you need?
Show hint
A and AAAA are different types.
Four characters you should tell apart first
| Character | What they do | How to read them here |
|---|---|---|
| Browser / app | The side that wants to use URLs or hostnames | Normally does not walk all the way to root by itself |
| OS stub resolver | The entry point for queries from apps | Typically asks a nearby recursive resolver for help |
| Recursive resolver | Gathers the final answer on behalf of the user and returns it | Because it caches, from the user's side it looks like "the source of the answer" |
| Authoritative server | Holds the authoritative data of a zone | If it is outside their scope, they send you onward with a referral |
Practice 1-2 — Who knows how much
If you mix up the roles, dig output and the meaning of TTL become hard to read.
Q2. Which role walks root / TLD / authoritative servers on behalf of the user and gathers the final answer?
Show hint
From the user's perspective, it is "the party that returns the final answer all bundled up."
Q3. Based on this chapter's description, select every kind of information you can look up via DNS.
Show hint
Recall A / MX / TXT. The body of HTTP or TLS is not DNS's job.
Q4. When you look at a returned DNS response, which axis helps your understanding the most if you become conscious of it first?
Show hint
This is a viewpoint we will return to many times in this course.
Why the hosts file is not enough on its own
The hosts file here means the OS's own static "name ↔ IP" mapping table — for example /etc/hosts on Linux / macOS, or C:\Windows\System32\drivers\etc\hosts on Windows. If every name-to-IP mapping were fixed and you could hand the same table to every machine, DNS would not be needed. In reality, IP addresses change, and you also want to look up information other than IP — mail delivery destinations, ownership-verification tokens, and so on.
On top of that, each organization wants to manage its own namespace, so it is more natural to split management by authority and query as needed than to maintain a single enormous static table in one place.
Do not stop your thinking at the understanding that "the DNS server returned an answer" — always be conscious of whether that answer is authoritative data, a cache, or a referral.
Key takeaways from this chapter
- DNS is a query for "name + type," which is an easy lens for sorting things out
- User, stub, recursive resolver, and authoritative server each have different roles
- From now on, we proceed with who holds the authoritative answer as our axis