Topic lessonTopic: Networking foundations
How DNS works: resolution, records and caching explained
DNS (Domain Name System) is a distributed system for querying information about names. For a website, it can resolve a hostname to an IP address. Receiving a DNS answer does not establish that a web page can be loaded. Separate the client, the resolver that finds an answer and the authoritative server that holds the zone’s information.
Trace the roles in name resolution, read common record types, explain caching and distinguish DNS problems from web-service problems.
Know that an IP address identifies a network destination. Names and addresses here are illustrative; this lesson performs no DNS queries or configuration changes.
Separate clients, recursive resolvers and authoritative servers
- Client resolver → Recursive resolverThe client asks about a name and record type; local resolution paths vary.
- Recursive resolver → Authoritative serverFollow delegation as needed. Root and TLD referrals are omitted from this role diagram.
- Recursive resolver → CacheReuse valid information where available instead of contacting every server for every lookup.
- Client resolver
- Receives an application’s request and uses its configured resolution path.
- Recursive resolver
- Finds an answer, potentially using cached information.
- Authoritative server
- Answers from its knowledge of an authoritative zone.
- Cache
- Retains answers for a limited time; it may not reflect a recent change.
An authoritative DNS server and a web server have different jobs. A recursive resolver can follow referrals from the root through a TLD to the relevant zone. Clients and browsers can also retain information, so not every page load produces the same sequence of external queries.
The record type is part of the question
| Type | Information | Distinction |
|---|---|---|
| A | An IPv4 address | Not page content or a URL path |
| AAAA | An IPv6 address | A separate address family, not an alias for A |
| CNAME | An alias to another name | Not a record containing the final IP address |
| MX | A mail exchanger | A mail-routing role, not the web destination |
| NS | An authoritative name server for a zone | A DNS role, not the website’s content server |
In https://www.example.com/docs/, the hostname is www.example.com. The scheme identifies HTTPS and /docs/ is a path sent to the web service. An A record does not store that whole URL.
TTL limits caching; it is not a global completion time
A record’s TTL bounds how long it may be cached. Updating the authoritative data can leave valid older answers in other caches. Lowering a TTL immediately before a change does not retroactively shorten the original lifetime of every previously cached answer.
Negative information can also be cached. NXDOMAIN, meaning that the name does not exist, differs from an existing name with no data of the requested type. Keep the response and the resolver that returned it rather than calling every failure a DNS outage.
Worked example: some clients still see an old address
| Observation | Next checks |
|---|---|
| Authoritative A data has the new value | Verify the zone, exact name and record type changed |
| One resolver still returns an old value | Inspect its cache lifetime, query destination and observation time |
| DNS returns the new IP but the page fails | Investigate reachability, TLS, HTTP and application responses separately |
| The response is NXDOMAIN | Check spelling, zone, delegation and negative caching |
Choose an option to see the result and explanation.
Collect the question and answer before changing settings
- Confirm the exact hostname and required record type.
- Record the resolver, response, TTL and observation time.
- Compare authoritative data with resolver results.
- Distinguish no response, negative answers, stale data and unexpected data.
- When DNS is as expected, continue with connectivity, TLS and HTTP.
Check, then explain in your own words
- Explain the client, recursive and authoritative roles.
- Distinguish A, AAAA, CNAME, MX and NS records.
- Use DNS evidence to choose the next connectivity or web-service check.
Check your understanding: Does lowering the TTL now immediately invalidate everyone’s old answer?
No. Previously cached answers have their existing lifetimes.
An authoritative update and the contents of distributed caches are separate observations. Compare the actual resolver, answer and time before deciding what a user is seeing.
Sources and conditions checked
Primary references are collected here with their scope, conditions and corresponding sections. Independent expert review and live-environment validation have not been performed.
- RFC 9499: DNS TerminologyChecked:
Scope and conditionsCurrent BCP terminology; obsoletes RFC 8499 and updates RFC 2308. Resolver, authoritative server, record types and negative answers; not an actual DNS test.
Used in this lessonSeparate clients, recursive resolvers and authoritative servers The record type is part of the question TTL limits caching; it is not a global completion time
Scope and conditionsResolution roles, delegation, resource records and positive caching. Terminology is cross-checked against RFC 9499; negative caching against RFC 2308.
Used in this lessonSeparate clients, recursive resolvers and authoritative servers TTL limits caching; it is not a global completion time
- RFC 9110: HTTP SemanticsChecked:
Scope and conditionsHTTP/HTTPS scheme, methods and response status semantics, including 200, 403 and 404. HTTP status is separate from application correctness.
Used in this lessonThe record type is part of the question
Scope and conditionsNXDOMAIN versus no-data responses and negative caching. Terminology updates in RFC 9499 are considered; no universal propagation-time promise.
Used in this lessonTTL limits caching; it is not a global completion time