Back to Cloudflare

DNS Resolution: Delegation, Caches, and Time to Live

November 4, 2026 Updated November 6, 2026 Wasil Zafar 21 min read

Follow recursive and authoritative answers step by step

Table of Contents

  1. The Resolver Asks on Your Behalf
  2. Delegation and Authoritative Answers
  3. Positive Answers, NXDOMAIN, and Cache Lifetimes
  4. Why Two Users Can See Different Answers
  5. Trace a Domain From the Root to Its Answer
  6. Compare Recursive and Authoritative Results

The Resolver Asks on Your Behalf

At 08:55 someone opens https://shop.example.com on a laptop in Lisbon. The browser knows the name but not the address, and the address is not in the URL. Before a packet leaves for the shop, a short conversation happens between machines the user never configured and cannot see.

Think of a hotel concierge. You ask for the address of a bakery on Main Street. The concierge either knows it or starts calling: the city registry says "shops on Main Street are registered with the district office," the district office says "that bakery keeps its own records," and the bakery gives the street number. Each intermediate reply is a referral, not an answer. Only the bakery speaks for the bakery, and only the concierge hands you the address.

That is the shape of DNS. The concierge is a recursive resolver, the registry and district office are the root and TLD nameservers, and the bakery is the authoritative nameserver for the zone. The terms that make the rest readable:

TermWhat it isWhere it lives
Stub resolverSends one query and waits; never walks the treeYour operating system
Recursive resolverWalks referrals, caches answers, returns the final copyYour ISP, or a public service such as 1.1.1.1
Authoritative nameserverHolds a zone and answers from that data; sets the AA flagThe zone owner or its DNS provider
DelegationA parent publishes NS records pointing at the child's nameserversThe parent zone
TTLSeconds a cache may reuse an answerEvery cache entry
RRsetRecords sharing a name, type, and class; cached and expired as one unitEvery cache entry

Start cold. Follow shop.example.com with nothing cached. The stub resolver asks the recursive resolver with recursion desired set; the resolver checks its cache, misses, and starts iterating with that bit cleared, because it is now doing the work.

  1. It asks a root server, which does not know the address. It returns a referral: the NS records for .com plus glue addresses.
  2. It asks a .com server, which refers it to example.com's nameservers — here Cloudflare's, such as hera.ns.cloudflare.com.
  3. It asks one of those. This time the reply is an answer: A 203.0.113.10, with the zone's TTL and AA set.
  4. It caches the RRset for that TTL and returns a copy to the laptop.

Figure 1 draws the walk and the branch where the cache already has the answer.

The Resolver Asks on Your Behalf
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','titleColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
flowchart TD
    S["Stub resolver in the laptop"] -->|"1 query, RD=1"| R["Recursive resolver 1.1.1.1"]
    R --> C{"Cached RRset with TTL left?"}
    C -->|"yes"| HIT["Return cached answer, TTL counting down"]
    C -->|"no"| ROOT["Root server: a.root-servers.net"]
    ROOT -->|"2 referral: .com NS plus glue"| TLD["a.gtld-servers.net"]
    TLD -->|"3 referral: example.com NS"| AUTH["Cloudflare authoritative NS"]
    AUTH -->|"4 AA=1, A 203.0.113.10, TTL"| R
    R -->|"5 cache the RRset"| HIT
    AUTH -.->|"timeout, REFUSED, or lame"| ERR["SERVFAIL to the client"]
    HIT --> S
    classDef primary fill:#132440,color:#ffffff,stroke:#0b172b;
    classDef secondary fill:#16476A,color:#ffffff,stroke:#0f314a;
    classDef ok fill:#3B9797,color:#ffffff,stroke:#2a6f6f;
    classDef danger fill:#BF092F,color:#ffffff,stroke:#7a0420;
    classDef warn fill:#c4873b,color:#132440,stroke:#8a5a1f;
    class ROOT,AUTH primary;
    class S,R,TLD secondary;
    class C,HIT ok;
    class ERR danger;

The first lookup of a popular name rarely reaches the root: a cache hit ends it at step one. That is why the tree feels abstract until you force the walk with dig +trace, which we do later.

The boundary is trust, not geography. The laptop trusts its resolver; the resolver trusts a referral chain seeded by a root hints file. Only the authoritative server speaks for the zone, and only its reply carries AA. Figure 2 layers those responsibilities.

Who answers at each DNS layer The stub resolver only asks. The recursive resolver caches and walks referrals. The root, TLD, and authoritative servers hold delegations and the zone, and only the authoritative server sets the AA flag. Client boundary Stub resolver asks one question trusts the reply Recursive resolver boundary Recursive resolver cache per RRset walks referrals owns no zone data Delegation tree (authoritative) Root zone delegates .com .com TLD delegates example.com Cloudflare NS holds the zone sets AA=1 RD=1 1 ask root referral referral answer + TTL cached copy, TTL left

Delegation and Authoritative Answers

Delegation is one small RRset. The parent holds an NS RRset for the child — example.com. NS hera.ns.cloudflare.com. — and usually nothing else. A referral carries those NS records in the authority section, an empty answer, and AA=0.

Positive and negative caching are different clocks. Positive caching stores an answer for its TTL; negative caching stores the fact that a name or type does not exist. The second surprises people because its lifetime is not the TTL of any record: it comes from the SOA record's last field, MINIMUM. RFC 2308 defines the rule, and Cloudflare's troubleshooting guide points at that field when a new record "still does not resolve."

Ask the same question of two servers. On 2026-11-04 they returned the same addresses and disagreed only on the TTL and the flags:

# Resolver: a cached copy, TTL in the tens of seconds, flags qr rd ra
dig @1.1.1.1 +noall +answer www.cloudflare.com A

# Authority: the configured value, TTL 300, flags qr aa rd
dig @ns3.cloudflare.com +noall +answer www.cloudflare.com A

Same data, different role. The authoritative server handed over the configured TTL; the resolver handed over what was left of its copy. The authority also warned that recursion was requested but not available — resolving other people's names is not its job.

Two servers, two jobs. The differences below are the ones that change how you debug:

DimensionRecursive resolverAuthoritative nameserverWhat it means when it goes wrong
Source of truthIts cache, filled by iterationThe zone file or API stateA wrong cached answer is stale, not forged
RecursionPerforms it on a missRefuses it; RA is clearSERVFAIL often means the walk could not finish
CachingStores positive and negative answersServes its own TTLs, caches nothing elseClearing a local cache does not clear an ISP's
AA flagNever setSet on answers from the zoneMissing AA means you are reading a cache
TTL in replySeconds remainingFull configured valueA climbing TTL means another cache instance
Who controls itISP, public resolver, your fleetZone owner and DNS providerDelegation errors are fixed at the parent
Typical failureStale or negative entry, SERVFAILREFUSED, timeout, lame referralDifferent symptoms need different commands
Plan boundary1.1.1.1 is a separate serviceCloudflare DNS: all plansAuthoritative DNS is not the proxy

Supported is not the same as included

Cloudflare DNS is authoritative hosting; it does not resolve the internet for your visitors, and 1.1.1.1 is a separate product. Every plan can host a zone and flatten an apex CNAME, but flattening every CNAME is paid, and private-origin proxying is limited to some Enterprise customers.

Figure 3 shows the exchange as a sequence, including a delegation that does not answer.

Delegation and Authoritative Answers
%%{init: {'theme':'base','themeCSS':'.edgeLabel .label text, .edgeLabel text, .edgeLabel span { fill:#132440 !important; color:#132440 !important; }','themeVariables': {'primaryColor':'#16476A','primaryTextColor':'#ffffff','primaryBorderColor':'#132440','secondaryColor':'#3B9797','secondaryTextColor':'#ffffff','secondaryBorderColor':'#132440','tertiaryColor':'#c4873b','tertiaryTextColor':'#132440','tertiaryBorderColor':'#132440','lineColor':'#5a6e82','textColor':'#132440','mainBkg':'#16476A','nodeBorder':'#132440','clusterBkg':'#eef3f7','clusterBorder':'#132440','edgeLabelBackground':'#ffffff','actorBkg':'#16476A','actorTextColor':'#ffffff','actorBorder':'#132440','activationBkgColor':'#3B9797','activationBorderColor':'#132440','signalColor':'#5a6e82','signalTextColor':'#132440','noteBkgColor':'#c4873b','noteTextColor':'#132440','noteBorderColor':'#132440','labelBoxBkgColor':'#a8dede','labelBoxBorderColor':'#132440','labelTextColor':'#132440','loopTextColor':'#132440','altBackground':'#f8f9fa','fontFamily':'DM Sans, sans-serif'}}}%%
sequenceDiagram
    autonumber
    participant C as Stub resolver
    participant R as Recursive resolver
    participant P as com TLD
    participant A as Cloudflare NS
    C->>R: A www.shop.example.com?
    R->>R: cache lookup, miss
    R->>P: NS example.com? (RD=0)
    P-->>R: referral, NS hera.ns.cloudflare.com
    R->>A: A www.shop.example.com? (RD=0)
    alt Authoritative answer
        A-->>R: NOERROR, A 203.0.113.10, TTL 300, AA=1
        R-->>C: cached answer, TTL counting down
    else Lame or unreachable delegation
        A--xR: timeout, REFUSED, or no zone
        R-->>C: SERVFAIL
    end

Positive Answers, NXDOMAIN, and Cache Lifetimes

Four fields settle most arguments. dig gives you four things to read first: the status, the flags, the answer count, and the authority section. Together they separate a real answer from a cached one, a nonexistent name from a missing type, and a broken delegation from a slow one.

A positive answer is NOERROR with a nonzero answer count. No authoritative flag means a cache replied. The TTL you see is either the zone's configured value or whatever remains on a cache copy:

# Zone configuration: the TTL the authority will serve.
variable "zone_id" { type = string }

resource "cloudflare_dns_record" "www" {
  zone_id = var.zone_id
  name    = "www.example.com"
  type    = "A"
  content = "203.0.113.10"
  proxied = false
  ttl     = 300
}
# The zone says 300; a resolver returns what is left of its copy.
dig @1.1.1.1 +noall +answer www.example.com A
sleep 5
dig @1.1.1.1 +noall +answer www.example.com A

A single TTL reading is a sample, not a global fact. 1.1.1.1 is anycast, so two queries five seconds apart can land on different cache instances and show a TTL of 16 and then 45. Nothing was wrong in that case; the two answers simply came from different copies.

Four outcomes look alike and mean different things. The status, the answer count, and the authority section tell them apart:

OutcomeStatusAnswer countAuthority sectionWhat it means
Positive answerNOERROROne or moreEmpty, or the zone's NSThe record exists and this is its value
NXDOMAINNXDOMAIN0The answering zone's SOAThe name does not exist; the SOA bounds reuse
NODATANOERROR0Zone SOAThe name exists, but not for the type you asked
Signed-zone negativeNOERROR0Zone SOAA real negative answer, not the textbook status

NXDOMAIN carries the answering zone's SOA. A random .com label asked of 1.1.1.1 returned the TLD's SOA with TTL 900; that TTL is how long the negative answer may be reused.

A missing type is not a missing name. Conflating NODATA with NXDOMAIN sends people hunting for a missing record when the type is what is missing. Two DNSSEC-signed Cloudflare zones returned the signed-zone form for a nonexistent label — the negative answer is real even when the status is not.

Only the last SOA field drives negative caching. The five numbers after the primary server and contact are serial, refresh, retry, expire, and minimum. Only MINIMUM governs negative caching, and RFC 2308 caps the effective value at the smaller of the SOA's own TTL and that field. That is why "lower the TTL on the new record" does not help when a resolver already holds an NXDOMAIN: the entry predates the record, so the new record's TTL is irrelevant.

Lower the TTL one old TTL ahead

If a change is coming, lower the TTL at least one old TTL in advance, so the caches that matter already hold short-lived copies. Changing the TTL and the target in one edit leaves everyone who cached the old RRset with both the old TTL and the old address.

Why Two Users Can See Different Answers

A cutover makes the clock visible. Suppose the name points at one address with a one-hour TTL, and at 09:00 you change the target.

  • A visitor whose ISP resolver cached it at 08:58 keeps the old address until about 09:58. Their browser and OS may hold copies too.
  • A visitor whose resolver first asks at 09:01 gets the new address immediately.
  • A visitor who queried api.example.com at 08:40, before it existed, has a cached negative answer. With an SOA MINIMUM of 1800, the name stays invisible to that resolver until about 09:10 even though you created it at 08:45.

Three people, one zone, three experiences. None is a DNS bug; each is a different cache with a different clock. Figure 4 puts the windows on one timeline.

Three cache windows during one DNS change User A cached the old address before the cutover and keeps it for the full TTL. User B asks after the change and sees the new address. User C cached a negative answer before the record existed and stays blind until the SOA minimum expires. One zone, three caches, one cutover at 09:00 User A old A 203.0.113.10, cached 08:58, TTL 3600 User B new A 198.51.100.20, first asked 09:01 User C NXDOMAIN, SOA min 1800 visible at 09:10 08:30 09:00 09:30 10:00 change applied

TTL is a staleness dial. Short TTLs shorten staleness, at the cost of more authoritative queries and less protection when those servers falter. Long TTLs absorb outages and cut query volume, at the cost of hour-long staleness during a migration. Cloudflare's proxied default is 300 seconds and cannot be edited, because the anycast addresses behind a proxied name must be able to move. DNS-only records run from 60 seconds to one day, or 30 seconds on Enterprise.

Boundary conditions explain most "DNS is inconsistent" reports:

  • An RRset is cached as a unit. Two A records with different TTLs may expire unevenly, and some resolvers normalize to the lowest value. Keep a set uniform.
  • A CNAME chain has a TTL per link, so effective staleness is the slowest link, not the name you edited.
  • A resolver is not one computer. Anycast, per-instance caches, DoH, VPNs, and EDNS Client Subnet can make two queries differ without any record changing.

An apex CNAME only works when it is flattened

A CNAME cannot coexist with other data. RFC 1034 forbids it, and an apex always has SOA and NS. Cloudflare's CNAME flattening resolves the target and returns A or AAAA instead: the zone stays valid, but asking the apex for a CNAME returns nothing, which can send you looking for an alias problem that does not exist. The same zone moved to a provider without flattening fails outright.

Trace a Domain From the Root to Its Answer

The whole path fits in seven steps. Steps 1–5 work against any public name; steps 6–7 need a zone you control.

# Step 1: the cached view
dig +noall +answer www.cloudflare.com A

# Step 2: repeat, then ask the authority for its own value
sleep 5
dig +noall +answer www.cloudflare.com A
dig @ns3.cloudflare.com +noall +answer www.cloudflare.com A

# Steps 3-4: walk from local root hints, then keep only delegations
dig +trace www.cloudflare.com A +nodnssec
dig +trace example.com NS +noall +authority +nodnssec

# Step 5: force the referral a resolver consumes at each hop
dig @a.gtld-servers.net www.example.com A +norecurse

# Steps 6-7: negative caching and TTL expiry, with a zone you control
dig +noall +answer +authority nope-1.example.com A
dig @1.1.1.1 +noall +answer ttl-lab.example.com A
Guided exercise

Trace a Domain From the Root to Its Answer

Execution status: design-only; not executed as a lab. Steps 1–5 were run read-only against public names on 2026-11-04; steps 6–7 need a controlled zone and were not executed, and no record change or timing measurement was performed.

Prerequisites. BIND 9's dig (preinstalled on macOS, packaged as bind9-dnsutils on Debian/Ubuntu) or kdig, plus outbound UDP/TCP 53. A domain you control is needed only for steps 6 and 7. No paid plan is required: authoritative DNS and apex CNAME flattening are available on all plans.

Setup. Work in a scratch directory and log your commands. If you control a zone, create ttl-lab.example.com with a 60-second TTL; otherwise run steps 1–5 against a public name and treat 6–7 as paper exercises.

  1. Cached view. Note each TTL in the answer.
  2. Repeat, then ask the authority. Five seconds later, expect a smaller TTL; a larger one is not a failure, since an anycast resolver can route elsewhere. The authority should return the full TTL with the authoritative flag.
  3. Walk the tree. Expect root servers, then .com gTLD servers, then Cloudflare. The trace starts from local root hints and sends its own iterative queries, so it can differ from what your resolver cached.
  4. Trim to delegations. The last non-empty authority section should name the assigned nameservers. If it names your old provider, the delegation is wrong, not the zone.
  5. Force a referral. Expect NS records in authority, an empty answer, and no authoritative flag — exactly what a resolver consumes at each hop. Asking the same server for the zone's NS instead returns the delegation in the answer section, because the parent is authoritative for it.
  6. Negative caching, with your own zone. Note the SOA's remaining TTL, create the record, then query again through the same resolver. Expect the negative answer to persist until that TTL expires. A Cloudflare-signed zone may answer NOERROR with zero answers instead of NXDOMAIN; either way the SOA is the countdown.
  7. TTL expiry, with your own zone. Set TTL 60, change the target, and poll every 15 seconds. Expect the flip only after the previous TTL elapses, not when the API returns success.

Failure checks. SERVFAIL from a resolver while the authoritative server answers means a broken delegation or DNSSEC validation failure. Missing aa on a server you believe is authoritative means you reached a cache. A trace that stalls at the root usually means port 53 is blocked or a VPN is intercepting. A TTL that never decreases means different resolver instances are answering.

Cost dimensions. Zero for the queries; a domain is typically USD 10–15 per year. A real low-TTL strategy multiplies query volume by roughly the reciprocal of the TTL.

Cleanup. Delete ttl-lab and any other throwaway records, restore the original TTL, and confirm with a final dig against the authoritative server.

Compare Recursive and Authoritative Results

Explain before you run. Ask the resolver and ask the authority; if they disagree, one answer is old, and the evidence says which.

Pass evidence. The recursive answer carries the recursion flags, no authoritative flag, and a TTL at or below the authoritative value. The authoritative answer sets AA and returns the full TTL. A trace reaches the nameservers the parent lists. A negative answer carries the zone SOA, and its remaining TTL matches the MINIMUM you read separately. After a TTL elapses, the recursive answer changes with no further action.

Fail evidence. An authoritative flag from an unexpected server, or a TTL higher than the authoritative server's, means you are not talking to the server you think. A resolver SERVFAIL while a direct query to the nameserver returns NOERROR points at a broken delegation or a DNSSEC validation failure. An NXDOMAIN that outlives the SOA MINIMUM, or a parent delegation naming a provider you left, points at the cache and the parent respectively. An apex CNAME query returning nothing while the site works is flattening, not a fault.

Self-check: negative answers. Why does a new record still return NXDOMAIN after you lower its TTL? The resolver cached a negative answer before the record existed, and that entry expires on the zone's SOA MINIMUM. What does a missing authoritative flag prove? That a cache replied, so the answer may be older than the zone.

Self-check: identity and aliases. Why can two queries to 1.1.1.1 five seconds apart show 16 and then 45? The resolver is anycast and the queries hit different instances with different cache ages. You move an apex CNAME to a provider that does not flatten, and the site breaks. Why? The apex CNAME only worked because Cloudflare flattened it; the protocol does not permit a CNAME beside SOA and NS.

Unresolved limitations. No controlled zone was modified, so no TTL expiry, negative-cache duration, or cutover timing was measured. Resolver behavior varies by operator and instance, and RFC 2308 permits a range.

Per-zone values. The SOA minimum is per zone: cloudflare.com returned 300 while example.com, also on Cloudflare, returned 1800. Limits change; values were checked on 2026-11-04 against the pages below, with DiG 9.10.6 on macOS.

Tooling caveat. kdig was not installed, so its syntax comes from the Knot DNS 3.6.2 manual, not from execution.

References (verified 2026-11-04):

  • Cloudflare DNS overview: https://developers.cloudflare.com/dns/
  • Time to Live (TTL): https://developers.cloudflare.com/dns/manage-dns-records/reference/ttl/
  • DNS record types: https://developers.cloudflare.com/dns/manage-dns-records/reference/dns-record-types/
  • General DNS issues and negative caching: https://developers.cloudflare.com/dns/troubleshooting/dns-issues/
  • DNS FAQ, change timing: https://developers.cloudflare.com/dns/faq/
  • Pending nameservers and dig +trace: https://developers.cloudflare.com/dns/zone-setups/troubleshooting/pending-nameservers/
  • CNAME flattening: https://developers.cloudflare.com/dns/cname-flattening/
  • RFC 1034, domain concepts and resolution: https://www.rfc-editor.org/rfc/rfc1034
  • RFC 1035, message format and TTL field: https://www.rfc-editor.org/rfc/rfc1035
  • RFC 2308, negative caching: https://www.rfc-editor.org/rfc/rfc2308
  • RFC 2181, clarifications including RRset TTLs: https://www.rfc-editor.org/rfc/rfc2181
  • IANA root zone database: https://www.iana.org/domains/root/db
  • kdig manual, Knot DNS 3.6.2: https://www.knot-dns.cz/docs/latest/html/man_kdig.html

Next in the Series

In Configure Records, Proxy Status, and DNSSEC, we'll explore Make DNS changes with a clear model of the orange cloud.