A stub resolver is the minimal DNS client built into an operating system or application that sends recursive queries to a full resolver and hands the final answer back to the program that asked. In DNS, it is the first link in every name lookup: it does not walk the hierarchy from the root itself, but delegates that work to a recursive resolver and trusts the response it receives.
The term comes from RFC 1123 and the DNS specifications in RFC 1034 and RFC 1035, which distinguish full-service resolvers from stub resolvers that depend on them. Almost every device on the Internet uses one, whether it is the resolver library inside an operating system, a local caching service, or a component embedded in a web browser.
How a stub resolver handles a name lookup
A stub resolver turns an application request such as “resolve example.org” into a DNS query message with the recursion desired flag set. It sends this message, usually over UDP port 53, to one of the configured recursive resolvers and waits for a response. The recursive resolver performs the iterative work of contacting root, top-level domain and authoritative servers, then returns a complete answer.
The stub resolver itself performs only a few local steps. It first consults local sources such as the hosts file, then an optional local cache, then the network. If the answer is truncated, it retries over TCP, and if a server does not respond within its timeout, it moves to the next configured server.
The table below shows the order of steps in a typical lookup on a desktop operating system.
| Step | Action | Result |
|---|---|---|
| 1 | Check the hosts file and local name policy | Static answer or continue |
| 2 | Check the local DNS cache, if present | Cached answer within its TTL or continue |
| 3 | Send query with recursion desired to a configured server | Recursive resolver begins its work |
| 4 | Receive the response and validate its format | Answer, NXDOMAIN or SERVFAIL |
| 5 | Retry with the next server or over TCP when needed | Recovery from timeouts or truncation |
| 6 | Return addresses to the application | Connection can start |
Stub resolver compared with other DNS resolvers
The defining difference is who performs the iteration. A stub resolver asks one question and expects a final answer, while a recursive resolver follows referrals across the hierarchy and an authoritative server answers only for its own zones. A forwarder sits in between: it accepts recursive queries but passes them on to another resolver instead of iterating.
| Component | Main task | Caches answers | Typical location |
|---|---|---|---|
| Stub resolver | Sends recursive queries and returns answers | Sometimes, briefly | Operating system or application |
| Recursive resolver | Iterates from root to authoritative servers | Yes, per TTL | ISP, enterprise or public service |
| Forwarder | Relays queries to an upstream resolver | Usually yes | Home router or local network |
| Authoritative server | Answers for zones it hosts | Not for other zones | Domain operator or DNS provider |
In practice the boundaries blur. A home router often acts as a forwarder, and a local caching stub such as systemd-resolved or a validating resolver like Unbound on localhost can sit between applications and the upstream server. The device still contains a stub in the strict sense, because some component delegates recursion elsewhere.
Common stub resolver implementations and configuration
Stub resolvers are configured mostly through the list of upstream servers and a few behavioral options. On Unix-like systems the classic configuration file is /etc/resolv.conf, which lists nameservers, search domains and options such as timeout and attempts. Other platforms store equivalent settings in network profiles or receive them through DHCP or IPv6 router advertisements.
| Platform | Component | Notable behavior |
|---|---|---|
| Linux with glibc | Resolver library and resolv.conf | No cache by default, up to three nameservers |
| Linux with systemd | systemd-resolved | Local cache, per-link servers, optional encryption |
| Windows | DNS Client service | System-wide cache, per-adapter servers |
| macOS and iOS | mDNSResponder | Unicast DNS plus Multicast DNS, scoped resolvers |
| Web browsers | Built-in resolver | Can use DNS over HTTPS independently of the system |
The search domain list deserves particular care. When a short name such as intranet is entered, the stub appends configured suffixes in turn, which is convenient on corporate networks but can leak queries to unintended domains and slow lookups when many suffixes fail.
Security properties of a stub resolver
A traditional stub resolver is a non-validating client that trusts its upstream server. Classic DNS over UDP is unencrypted and unauthenticated, so anyone on the path between the stub and the recursive resolver can observe queries or attempt to inject forged responses. Randomized query IDs and source ports reduce, but do not remove, the risk of spoofing.
Modern stubs address these weaknesses in several ways, each protecting a different part of the path.
| Mechanism | What it protects | What it does not cover |
|---|---|---|
| DNS over TLS | Confidentiality and integrity on port 853 | Trustworthiness of the resolver itself |
| DNS over HTTPS | Same, carried inside HTTPS on port 443 | Data authenticity at the source zone |
| AD flag with trusted resolver | Signals DNSSEC validation upstream | Tampering on an unencrypted path |
| Local validating stub | Full DNSSEC validation on the device | Privacy of query contents |
A common misconception holds that the AD bit proves an answer is authentic. It only reports that the upstream resolver validated the data, so a stub should rely on it only over a trusted, protected channel.
Troubleshooting stub resolver problems
Many reported DNS outages are in fact failures at the stub layer, not in authoritative zones. Tools such as dig and nslookup bypass parts of the system stub, so a lookup can succeed in a terminal while applications still fail, which is a strong hint that the local configuration or cache is the problem.
- Lookups take several seconds: the first nameserver is unreachable, and every query waits for its timeout before trying the next.
- Old addresses persist after a change: a local cache is serving stale records until their TTL expires or the cache is flushed.
- Names resolve differently by application: a browser uses its own resolver, often with DNS over HTTPS, instead of the system stub.
- Internal names fail over VPN: split-horizon DNS settings are not applied to the correct network interface.
Understanding it simply
Every time you open a website, your device needs the address behind its name. The stub resolver is the small helper on your device that asks for it. It does not search the whole Internet by itself.
Instead, it is like asking a well-informed receptionist. The stub passes the question to a bigger resolver, that resolver does the legwork, and the answer comes back. The stub only asks and relays, so its choice of whom to ask matters greatly for speed and privacy.
Applied in practice
An IT administrator at a company with 300 laptops receives complaints that web pages take about five seconds to start loading. Pages load quickly once they begin, and dig queries against the public resolver answer in under 30 milliseconds.
Inspecting the laptops shows that the DHCP server hands out two DNS servers, and the first one, an old internal server that was decommissioned, no longer responds. Each stub resolver waits for the five-second timeout before trying the second server, and most laptops do not cache the failure.
The administrator removes the dead address from the DHCP scope and enables encrypted DNS over TLS to the company resolver at the same time. After the leases renew, page start delays drop below 100 milliseconds, and help desk tickets about slow browsing stop within a day.