How DNS Works: Records, Resolution and Cache Troubleshooting

DNS lets applications look up information associated with names, including addresses used to contact a service. A recursive resolver can answer from cache or obtain information through the DNS hierarchy. The authoritative server publishes data for its zone, while cached answers can remain valid for their remaining lifetime.

Dec 09, 2024 - 16:48
Updated: 
103.3k

Networking in IT Infrastructure · Explainer

How DNS Works: Records, Resolution and Cache Troubleshooting

Quick answer: DNS lets applications look up information associated with names, including addresses used to contact a service. A recursive resolver can answer from cache or obtain information through the DNS hierarchy. The authoritative server publishes data for its zone, while cached answers can remain valid for their remaining lifetime. To troubleshoot a changed record, compare the name, record type, resolver and collection time before changing settings. DNSSEC validates signed DNS data; encrypted DNS transport protects a different part of the exchange.

Key takeaways

  • Ask which name and record type failed.
  • Cached responses can avoid a complete hierarchy lookup.
  • A CNAME is a DNS alias, not an HTTP redirect.
  • Separate NXDOMAIN, NODATA and resolution failures.
  • Compare cache expiry before assuming a migration failed.

Table of Contents

Who answers a DNS lookup?

In a fictional migration, Priya changes portal.example from 192.0.2.10 to 192.0.2.20. One colleague sees the new service while another still reaches the old address. The first question is which resolver answered each lookup and when it obtained its data.

A device usually asks a recursive resolver through its configured resolution path. On a cache miss, the resolver can follow referrals from the root toward the relevant top-level domain and authoritative servers. Cached delegations and records mean it need not repeat every step for each browser visit. RFC 1034 explains this distributed design.

An authoritative answer describes the zone's published data. A recursive answer describes what that resolver can return, which may include cached data. Record both roles instead of calling every DNS server the same thing.

Which record type does the application need?

Address records are only part of DNS. RFC 1035 defines core records and message formats, while later RFCs extend them. An application asking for an address may follow an alias; a mail sender instead needs mail-routing information.

Priya checks the full name portal.example, not merely example, and keeps A and AAAA results separate. A correct IPv4 answer does not explain an obsolete IPv6 record. The application might also use a proxy, a local hosts entry or its own cache, so a DNS tool and a browser need not share every setting.

RecordMeaningCommon mistake
A / AAAAIPv4 / IPv6 address informationChecking only one address family
CNAMEAlias to another DNS nameCalling it an HTTP redirect
MXMail exchanger informationUsing it to diagnose a web page
TXTText data used by particular protocolsAssuming every value authenticates a site

Why can an old address remain after a change?

A cached record has a remaining lifetime derived from its TTL. Updating an authoritative record does not remotely erase every existing cache. Lowering a TTL immediately before a change also does not shorten an older copy already held with a longer lifetime.

RFC 9499 gives current DNS terminology and describes TTL as a maximum cache lifetime, subject to applicable resolver behavior. Record when the cached answer was acquired. Different resolvers may have fetched it at different times.

In Priya's example, a record cached at time 100 with TTL 60 remains usable at time 130 for another 30 seconds. A second resolver that asks after the authoritative change can obtain the new address earlier. This is a normal explanation to test before declaring the DNS provider broken.

Can you model cache expiry without network requests?

The following checked Python example uses documentation addresses and a fixed clock. It models a simple positive cache entry, not a complete resolver, and performs no DNS lookup. The supplied authoritative value changes while an existing cached answer remains valid.

cached_at = 100
ttl = 60
old_answer = "192.0.2.10"
new_answer = "192.0.2.20"
for now in (130, 159, 160):
    remaining = max(0, cached_at + ttl - now)
    answer = old_answer if remaining else new_answer
    source = "cache" if remaining else "new lookup"
    print(f"t={now}: {answer}, {source}, remaining={remaining}")
t=130: 192.0.2.10, cache, remaining=30
t=159: 192.0.2.10, cache, remaining=1
t=160: 192.0.2.20, new lookup, remaining=0

At time 160 the toy entry expires and the model selects the new answer. A real resolver must also handle aliases, separate record sets, errors and other protocol rules. Change the sample TTL to 120 and calculate which rows should still use the cache before running the exercise again.

What do negative answers and failures mean?

NXDOMAIN states that the queried name does not exist. NODATA means the name exists but lacks the requested record type. A timeout or SERVFAIL is a different outcome and needs investigation of the resolver, authority, validation or network path.

RFC 2308 describes negative caching, including the role of SOA information. A recently created name may remain absent in a resolver's negative cache for its applicable lifetime. Do not apply the positive A-record TTL blindly to that case.

ObservationPossible explanationNext comparison
Old A recordUnexpired positive cacheRemaining TTL and authoritative data
NXDOMAIN after creationCached negative answerNegative lifetime and exact name
SERVFAILResolution or validation problemResolver details and authoritative reachability
DNS works, page failsLater connection or application faultTransport, TLS and HTTP evidence

How do DNSSEC and encrypted DNS differ?

RFC 4033 describes DNSSEC's authentication and integrity goals for DNS data. Validation needs the relevant signed chain and validating behavior; it does not certify a website's honesty or hide DNS questions from every observer.

RFC 8484 specifies DNS over HTTPS, which protects the transport between a client and its selected DoH service. That service still processes the query. Transport encryption and validation of DNS data solve different problems and can be used together.

Use the organisation's approved resolution policy. Switching to a public resolver can break private-zone access or change where queries are disclosed. A resolver change is a controlled troubleshooting action, not a universal speed or security improvement.

What evidence should a DNS troubleshooting ticket contain?

Priya records the failing application, exact name, requested type, configured resolver, observed answer and collection time. She compares the old and new records with the planned cutover and checks whether both address families and dependent aliases were updated.

Keep the original observations before clearing a cache. If the answers become correct while the page still fails, follow the connection to TLS and HTTP instead of repeatedly editing DNS. Do not use a failed ping as proof that DNS is broken: name resolution and ICMP response are separate observations.

Close the migration ticket only when the intended application works through the expected client path and the old service can be retired safely. Record any resolver policy or cache exception that explains a remaining difference.

Related reading: OSI troubleshooting layers; recording infrastructure relationships.

References

Frequently Asked Questions

No, caches and previously learned delegations can let a resolver answer without repeating the complete hierarchy for each request.

No, a CNAME aliases one DNS name to another, while an HTTP redirect instructs a client at the web protocol layer.

Their resolvers, caches, network views, requested record types or collection times can differ, so compare those details before changing configuration.

DNSSEC authenticates signed DNS data rather than encrypting the query transport; encrypted DNS protocols address a separate communication path.

No, a host can resolve correctly while ICMP is blocked or unanswered, so inspect the actual lookup result separately.

NXDOMAIN indicates the name does not exist, while NODATA indicates an existing name lacks the requested record type.

No, an older cached copy can retain its previously obtained lifetime, so plan TTL changes ahead of a migration.

No, it uses fixed timestamps and documentation addresses to illustrate cache expiry without network requests or changes to your system.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.