SecDNS

DNS basics — how recursive resolvers and authoritative servers work together

A practical introduction to the Domain Name System covering record types, recursive vs authoritative roles, query flow, caching, and the tools you can use to inspect each step.

DNS basics — how recursive resolvers and authoritative servers work together

DNS is the address book of the internet. This article walks through the journey of a single query — from your laptop typing example.com in the browser, to the IP that ships back milliseconds later. It is aimed at developers, IT generalists and security folks who want a working mental model without diving into the wire format yet.

What DNS actually is

The Domain Name System is a globally distributed lookup service that maps human-readable names (secdns.app) to records the network stack can act on — typically A (IPv4) or AAAA (IPv6) addresses, but also MX (mail servers), TXT, CAA, SRV and many more. RFC 1034 describes the conceptual model and RFC 1035 specifies the wire format.

DNS is hierarchical. The empty root (.) delegates to top-level domains (com., org., uk.), which in turn delegate to second-level domains (example.com), and so on. Each level is authoritative for the records directly below it, and each delegation is implemented with NS records pointing at the next nameserver.

"The domain name space is a tree structure. Each node and leaf on the tree corresponds to a resource set." — RFC 1034 §3.1

Recursive vs authoritative servers

Two very different roles share the name "DNS server":

RoleWhat it doesExamples
Recursive resolverAccepts queries from clients and walks the hierarchy on their behalfYour ISP resolver, 1.1.1.1, SecDNS
Authoritative serverHolds the actual zone data and answers only for the names it ownsRoute 53, NS1, your own BIND server

Clients (laptops, phones, IoT gear) only talk to recursive resolvers. The resolver does the legwork of finding the authoritative server for a name and caching the result so the next lookup is fast.

The query lifecycle

When your browser asks the OS to resolve www.example.com, the following usually happens:

  1. The stub resolver on the OS forwards the query to the configured recursive resolver — over UDP/53, TCP/53 or an encrypted transport like DoH or DoT.
  2. The recursive resolver checks its cache. On a hit it answers immediately.
  3. On a miss, it queries a root server (a.root-servers.net. through m.root-servers.net.) for com. NS records.
  4. It then queries the com. TLD nameserver for example.com. NS records.
  5. Finally it queries one of example.com.'s authoritative servers for www.example.com. A?.
  6. The answer (plus TTL) is cached and returned to the stub.

You can reproduce the walk with dig:

dig +trace www.example.com

Each hop is bounded by a TTL — a hint from the zone owner telling resolvers how long they may cache the record. Short TTLs make changes propagate fast but increase load on the authoritative servers.

What the resolver actually sees

Beyond the answer record, the resolver collects several signals on each query: response code (NOERROR, NXDOMAIN, SERVFAIL), DNSSEC validation state (see DNSSEC explained), EDNS options, response size and round-trip timing. Protective DNS products like SecDNS combine those signals with threat-intel lookups to decide whether to answer truthfully or block the query — covered in What is protective DNS?.

Further reading

Frequently asked questions

What is the difference between a recursive and an authoritative DNS server?

A recursive resolver accepts a question from a client and chases down the answer by walking the DNS hierarchy. An authoritative server holds the actual zone data for a specific domain and answers only for the names it owns. Clients almost always talk to recursive resolvers, never directly to authoritative servers.

Why do DNS records have a TTL?

The TTL (time-to-live) tells caches how many seconds they may keep a record before refreshing it. Short TTLs make changes propagate quickly but increase load on authoritative servers. Long TTLs reduce load but slow down failover.

Is DNS encrypted by default?

No. Classic DNS over port 53 is plaintext and trivially observable on the wire. Modern stacks support DNS over HTTPS (DoH) and DNS over TLS (DoT), which encrypt the channel between client and resolver but do not change how the rest of the hierarchy works.

What command can I use to see a query lifecycle?

Run `dig +trace example.com` from any Unix-like machine. It will show the root, TLD and authoritative responses in order, which is the easiest way to see the hierarchy in action.