← Module 05 · Application Layer & Name Resolution

DNS Resolution Flow

One question from you turns into a chain of increasingly specific questions someone else asks on your behalf, walking the DNS (Domain Name System) hierarchy one level at a time.

Short answer: A client usually asks a recursive resolver for a final answer. The resolver uses cached records, follows referrals itself, or forwards the question to another resolver. A successful answer may contain an address, an alias, or other record types, not just an IP address.

Before this: DNS hierarchy and record types.

A concierge who does the legwork for you

A recursive resolver, perhaps your organization's DNS service, your ISP's (Internet Service Provider's), or a public one like 8.8.8.8, acts like a concierge. You ask one question; they consult their notebook or ask others and return an answer. In the cold lookup below, with no useful cached records and no forwarding, they ask increasingly specific direction-givers: root, then TLD (Top-Level Domain), then authoritative. An ordinary stub client leaves that work to its resolver.

That distinction has a name. The client requests recursion: resolve the name and return an answer or error. In the illustrated hierarchy walk, the resolver sends iterative queries: a server can supply an answer or a referral to the next authority. A forwarding resolver instead asks another recursive resolver to finish the job, like one concierge consulting another. Its onward query need not be iterative.

YOU RESOLVER ROOT TLD AUTH 1. Client → Resolver: a recursive query "What's the IP for example.com? Give me the final answer." 2. Resolver → Root: an iterative query Root doesn't know it, but says: ask the .com TLD servers 3. Resolver → TLD: an iterative query TLD doesn't know it either, but says: ask example.com's server 4. Resolver → Authoritative: an iterative query The authoritative server actually knows: here's the A record 5. Resolver → Client: the final answer The resolver caches it and hands the IP address back to you
Five logical stages, not five network hops or five packets. This simplified cold lookup omits referral replies, retries, and possible alias lookups. Cached answers or delegations can skip stages.
StepWho asksWho answersQuery type
1ClientRecursive resolverRecursive: do the whole job for me
2ResolverRoot serverIterative: "who handles .com?"
3ResolverTLD serverIterative: "who's authoritative for example.com?"
4ResolverAuthoritative serverIterative: "what's the A record?"
5ResolverClientFinal answer, now cached

Read a DNS answer

Consider this illustrative record for a documentation-only hostname. It is not a live lookup or a command result:

portal.example.  300  IN  A  192.0.2.80

portal.example. is the fully qualified name; 300 is the TTL in seconds; IN is the Internet class; A means an IPv4 address. The address is from a documentation range. If a resolver cached this answer 40 seconds ago, a response might carry about 260 seconds of remaining TTL. The concierge's notebook keeps the answer and an expiry time, not a permanent guarantee.

To query your configured resolver on Windows, use Resolve-DnsName example.com -Type A -DnsOnly. On Linux with BIND's dig installed, use dig example.com A. Real answers and timing vary. In dig's response flags, rd means recursion was requested, ra means the server supports recursion, and aa marks an authoritative answer. Neither rd nor ra proves that a fresh hierarchy walk occurred.

Distinguish an absent name from a failed lookup

ResultMeaningNext check
NXDOMAINThe queried name, or the final target of a CNAME chain, does not exist according to the answerCheck spelling, aliases, search suffixes, the authoritative zone, and whether a VPN uses private DNS.
NODATA: NOERROR with no requested records, not a referralThe name exists but has no record of that type. NODATA is not a separate response code.Compare A and AAAA and inspect the answer and authority sections. An empty answer alone can also be a referral.
SERVFAILThe resolver could not complete the lookupCheck resolver logs, authoritative reachability, delegation, and DNSSEC validation. It does not mean the name is absent.
TimeoutNo response arrived within the client's waitCheck the configured resolver and permitted UDP/TCP 53 path. The resolver may be unreachable, filtering, or still waiting upstream.

A concierge who reports "no such office" (NXDOMAIN) differs from one who cannot contact the directory (SERVFAIL), or never answers you (timeout). Negative answers can also be cached under rules based on the zone's SOA record. Browsers may use DNS over HTTPS and a different resolver from a command-line tool, so compare the actual query path before calling two answers inconsistent.

WHY MOST QUERIES NEVER ACTUALLY REACH THE ROOT

Resolvers cache answers and delegations subject to their TTLs and local policy. Even when the requested A record is missing, a cached delegation may let the resolver start at the authoritative server instead of the root. How often queries hit cache depends on traffic and TTLs; an unfamiliar name does not necessarily mean an entirely cold resolver.

Continue with how DHCP supplies resolver settings or DNS in a complete page load.