Introduction
Convert a DNS TTL to time units and estimate how much of a cached lifetime remains. A name lookup crosses two administrative boundaries. A client trusts a recursive resolver to find an answer, while authoritative servers publish data for particular zones. The time a client sees a change also depends on cached copies.
Formula and calculation
remaining = max(0, original TTL − elapsed time)This is an ideal age calculation for one cached response. Resolvers can evict data early, refresh it, or use stale-answer policies, so it does not predict every resolver's answer.
- TTL · seconds
- cache lifetime carried by one DNS answer
- elapsed · seconds
- time since that answer entered this cache
Method and concepts
A record has an owner name, type, class, time to live and type-specific data. An A record supplies one IPv4 address. An AAAA record supplies one IPv6 address. Several records with the same owner, class and type form a resource record set.
- Enter the quantities in the units or notation shown by the input labels.
- Calculate and compare the output with the worked example.
DNS records, delegation and caching diagram
- Application stub
- Recursive resolver
- Parent zone · NS referral
- Child authority · A or AAAA
Worked examples
Age one cached record
- Enter a TTL of 3600 seconds and an elapsed interval of 900 seconds.
- 2700 seconds remain in this ideal cache model. Another resolver can have a different insertion time.
DNS records, delegation and caching: Read a delegated lab zone and its five-minute TTL
- In a teaching copy of example.org, delegate lab.example.org to ns1.lab.example.org. Supply 192.0.2.53 as parent glue so the resolver can reach the child authority.
- The child publishes sensor.lab.example.org with A 192.0.2.40 and AAAA 2001:db8::40, each with TTL 300 seconds. The resolver queries the requested type and caches its answer.
- An A answer cached at 10:00:00 has about 180 seconds left at 10:02:00, assuming an unaltered TTL and ordinary cache operation. An edit at 10:01:00 does not invalidate that cached copy.
Reference table
| Type | Data points to | Example role |
|---|---|---|
| A | IPv4 address | Sensor address |
| AAAA | IPv6 address | Dual-stack sensor address |
| NS | Authoritative server name | Child delegation |
| SOA | Zone parameters | Includes negative-caching data |
Reading the result
A resolver can reuse a cached answer while its TTL permits. The remaining TTL decreases with time. A newly edited record can therefore coexist with an earlier answer in another resolver's cache. Cached delegation and address records can also expire at different times.
Common mistakes
- Using a server's IP address as the data of an NS record, whose data is a domain name.
- Lowering the TTL at cutover time and expecting it to shorten the lifetime of copies cached earlier.
Frequently asked questions
Does querying AAAA require sending DNS over IPv6?
No. The requested record type and the transport address family are independent. An IPv4 connection to a resolver can carry a query for an IPv6 address.
Why can a newly created record still appear missing?
A resolver may have cached an earlier negative response. Check which authority now serves the zone and the remaining negative cache lifetime.
What is the difference between a recursive resolver and an authoritative server?
A recursive resolver finds or returns an answer for a client and can cache it. An authoritative server publishes records for zones for which it is responsible.
Does an empty answer always mean a domain does not exist?
No. A name can exist without the requested record type. NXDOMAIN means the queried name does not exist; NODATA means the name exists but lacks that type, while timeouts and SERVFAIL are different failures.
Can a DNS name have both a CNAME and other data at the same owner?
A CNAME owner is an alias and generally cannot also carry ordinary record data at that same name, aside from protocol-defined exceptions such as DNSSEC-related records.
Does changing an authoritative record immediately change every cached answer?
No. Recursive caches can retain an older answer for its remaining TTL, and negative answers can also be cached. Different resolvers may refresh at different times.
What does delegation do in DNS?
A parent zone publishes delegation data that identifies authoritative name servers for a child zone. Recursive resolution follows that chain to ask the child's authority for its records.
Does an authoritative answer mean a server is the only place with the data?
No. The authoritative zone is the source of published data, while recursive resolvers and client caches can hold copies until their cache lifetimes expire.
Can a DNS record have a zero TTL?
A zero TTL tells compliant caches not to retain the answer for a positive caching interval. It does not guarantee instant observation everywhere or bypass other layers of caching.
Why is a CNAME target written as a domain name rather than an IP address?
A CNAME points one DNS name to another canonical DNS name. The target can then have its own A or AAAA records and be updated independently.
What does an SOA record describe?
An SOA record identifies core zone authority information and includes a serial plus refresh, retry, expire, and negative-cache timing fields. Its values guide secondary servers and some resolver behavior.
What does an MX preference number mean?
Lower numeric preference values are tried before higher values. If multiple MX records share a preference, senders can distribute attempts among them according to implementation policy.
Can a TXT record contain multiple strings?
Yes. DNS TXT RDATA can consist of one or more character strings. Applications may concatenate or interpret those strings according to their own rules.
How is a PTR record name found from an IPv4 address?
The octets are reversed and appended to in-addr.arpa. For IPv6, the address's nibbles are reversed under ip6.arpa.
Does TTL control how long a domain registration lasts?
No. DNS TTL controls caching of a resource record. Domain registration expiry is a separate registry and registrar concept.
Further learning and references
- RFC 1034 · DNS zones and resolution
Reference source for the concepts and service described in this guide.
- RFC 3596 · AAAA records
- RFC 2308 · Negative caching

