Sub topic 2
How a Name Is Resolved, Step by Step
This chapter assumes you know what a website and an IP address are, and that you can run basic command-line commands.
The resolution process
When a program connects to www.example.com, it usually asks the operating system’s stub resolver for an address. The stub resolver sends the question to a recursive resolver, often operated by an internet provider, company, or public DNS service.
If the answer is not cached, the recursive resolver follows DNS’s hierarchy:
The root server refers the resolver to the .com name servers. A TLD server then refers it to the authoritative name servers for example.com. The authoritative server holds the zone’s records and returns the requested answer.
Use dig to inspect this process:
dig example.com A +short
dig +trace www.example.comThe first command asks the default resolver for IPv4 addresses. The second displays the delegation path.
Core record types
A DNS record maps a name to information about that name.
| Record | Purpose | Example value |
|---|---|---|
| A | Maps a name to an IPv4 address | `192.0.2.10` |
| AAAA | Maps a name to an IPv6 address | `2001:db8::10` |
| CNAME | Makes one name an alias of another | `www.example.com.` |
| MX | Selects mail servers for a domain | `10 mail.example.com.` |
| NS | Identifies authoritative name servers | `ns1.example.com.` |
| TXT | Stores text, often for verification or email policy | `v=spf1 mx -all` |
| SOA | Describes zone authority and timing values | Zone metadata |
A website commonly needs an A or AAAA record. A subdomain alias commonly uses CNAME. Email delivery uses MX, not A alone.
TTL, caching, and delegation
Each record has a TTL, or time to live, measured in seconds. Resolvers may cache an answer until its TTL expires. Therefore, changing a record does not immediately replace every cached answer.
A domain registrar stores the registration. Its delegation identifies which authoritative name servers control the domain. You can either use the host’s name servers or keep another DNS provider and copy the host’s required records there.
To compare resolver views, query a specific resolver:
dig @1.1.1.1 example.com AExercise
You changed an A record, but one resolver still returns the old address. What is the first explanation to check?
Show answer
Check the record’s TTL and the resolver’s cached answer. The old answer may remain until that TTL expires.