concept Domains & DNS
DNS TTL
A DNS answer can outlive a change at its source. Follow one resolver cache—not a global propagation clock.
What it means
DNS TTL is the lifetime attached to a resource record that can limit how long a resolver reuses a cached answer. It starts for the cached copy; it is not a global countdown synchronizing every resolver. Changing the authoritative record does not forcibly remove an older copy held elsewhere. Caching model Record TTL
Try it
Simulation — replay one later DNS question. Choose a timing preset or edit the three times. The model starts with one cached answer at time zero and asks what a single query at the selected time would receive. Moving the time control does not secretly perform intermediate queries.
With TTL 60 seconds and an authoritative change at 20 seconds, a query at 30 seconds still uses the old saved answer and has 30 seconds of its original lifetime left. Compare the before-expiry, exact-expiry and after-expiry presets. At exactly 60 seconds, the original entry is no longer reusable and a fresh lookup can obtain the new value. Cache lifetime
| Replay | Answer used | What this demonstrates |
|---|---|---|
| TTL 60, change 20, query 30 | Old cached value | An authoritative edit does not rewrite an existing cache entry |
| TTL 60, change 20, query 60 | New value from a fresh lookup | Equality with expiry is not a cache hit |
| TTL 0, change 20, query 30 | New value from a fresh lookup | Zero TTL does not provide a reusable saved answer |
| TTL 60, change 0, query 30 | New value was cached initially | The change already existed at the initial lookup |
“Remaining lifetime” describes the original saved entry in this replay; after its expiry the display does not start a second hidden countdown. Lowering a newly served TTL cannot shorten a lifetime another resolver already saved. Reset restores 60/20/30 and clears invalid input. Times are limited to 0–120 seconds for the scene, not as a DNS protocol limit.
This model excludes eviction, prefetch, multiple resolvers and serve-stale behavior. Those exclusions are why its exact timeline is useful for learning but cannot establish when every visitor will see a real change. Serve-stale extension
One saved answer, one clock
In this simulation the resolver obtains an answer at t = 0. No further query occurs until the selected time. Moving the time control replays that same scenario; it does not secretly refresh the cache on the way.
With TTL 60 s and an authoritative change at 20 s, a query at 30 s still uses the saved old answer. It has 30 s remaining. At 60 s the saved answer is no longer reusable in this model, so a successful lookup returns the new answer. Expiration does not itself send a query: a query at 90 s would trigger the lookup at 90 s, not retroactively at 60 s.
Expiration is not propagation
A TTL belongs to the cached information. A different resolver may have obtained its answer at a different time, so its remaining lifetime can differ. Changing the record's TTL now does not rewrite a lifetime already stored elsewhere. For a planned change, a lower TTL must have been obtained by a cache before it can affect that cache's behavior. Caching and TTL
An earlier cache does not inherit the new TTL
Suppose a resolver stored www.example.test A 192.0.2.10 with 300 seconds of remaining life at 12:00. The authoritative owner then changes the address at 12:01 and sets the new record TTL to 30 seconds. The resolver may continue returning its earlier value until its own retained copy expires. Setting 30 on the current authoritative answer does not retroactively subtract 270 seconds from the old copy. Another resolver that never cached the old value could query authority and obtain the new answer immediately. If the old name was absent, negative-answer caching follows different rules; a failure to reach authority is not an NXDOMAIN proof. DNS cache Serve stale
In practice
For an authorized change, retain the previous RRset and verify the active authoritative data first. Compare the same owner name, type and class at the authoritative server and a named resolver, recording observation time and remaining TTL. When outputs disagree, ask whether the resolver holds an eligible previous answer before rewriting configuration. Some resolvers can conditionally serve stale information when authoritative DNS is unavailable, so TTL expiration alone is not a guarantee of a new answer.
A zero TTL means the answer can be used for the current transaction but is not cached for reuse. Here a query at any selected time consults the source when TTL is zero. When the change time is also zero, the source changes before the initial lookup, so the initial answer is already new. Resource record TTL
About the boundary
This is one resolver, one record and an available authoritative source, with no later queries before the selected one. It excludes prefetch, early eviction, other cache layers, lookup delay and failures. Real resolvers can be configured to serve stale data when refresh fails under the conditions described in RFC 8767. Therefore, “TTL elapsed” is not an unconditional guarantee that no old answer can ever be served. Serve-stale behavior
Key takeaways
Use the TTL of the earlier cached entry to reason about that resolver, not to promise a worldwide completion time. An authoritative check establishes what is published; a resolver check establishes what that resolver returned at a stated time.
Frequently asked questions
Editorial questions, answered from the sources listed for this article.
Will lowering the TTL clear answers that are already cached?
No. A resolver may keep an answer for the lifetime it saved earlier. A lower TTL applies to a later answer, not retroactively to every existing cache entry.
Does TTL zero guarantee that every real lookup reaches the authoritative server?
It prevents normal reuse of that zero-TTL record, but a complete lookup can involve other cached records and implementation behavior. This scene models only one record and does not promise a network-wide observation.
When does a resolver start its cached TTL?
It starts from its receipt or caching of the relevant answer and decreases over time. A different resolver can have a different remaining lifetime.
Can negative answers be cached?
Yes. An eligible NXDOMAIN or NODATA reply can be cached with an SOA-derived limit. It is not necessarily governed by the positive record TTL of a record created later.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- RFC 1034 — Domain concepts and facilities
Sections 3.6 and 4.3.4. TTL in seconds and caching to avoid repeated lookups.
Checked .
- RFC 1035 — Domain implementation and specification
Section 3.2.1, read with RFC 8767 section 4. Resource records and zero-TTL non-caching behavior; later TTL definition amendments apply.
Checked .
- RFC 8767 — Serving stale DNS data
Sections 4–6. Amended TTL definition and the serve-stale exception when refresh fails.
Checked .