Learn how DNS resolvers turn user requests into name-server queries, use recursion and referrals, and improve performance with caching.
What you will be able to do
- Describe how a resolver connects user programs with name servers and local cached information.
- Identify how a DNS query’s domain name, type, and class specify the requested records.
- Explain the difference between recursive and non-recursive resolution, including the RD and RA flags.
- Trace how referrals, CNAME results, errors, and cached responses affect resolution.
01
1. DNS resolution as a service
DNS resolution connects software that needs naming information with the name servers that hold or locate it. A resolver performs this connecting role, so an application can ask for DNS information without communicating with every name server itself.
The resolver can draw on two places: responses obtained from name servers and information already stored in its local cache. This arrangement gives the application a single point for requesting name-related data.
For example, when a program needs information about a domain, it gives the request to its resolver. The resolver then determines how to obtain the requested records and returns the result to the program.
02
2. What a resolver does
A resolver builds a DNS query and sends it toward a name server able to provide the requested information. It must have access to at least one name server, either to receive the result directly or to continue through referrals.
A name server’s reply can take the form of an answer or a referral. An answer supplies a response to the request, while a referral directs the resolver toward another place to continue its work.
Suppose a resolver asks a known name server about a domain and receives a referral. The resolver can use that direction to ask another name server, repeating the process until it obtains an answer or encounters an error.
03
3. How a query states its request
A DNS query identifies the information being sought with three core parts: the domain name, QTYPE, and QCLASS. Together, these fields narrow the request to particular resource records.
QTYPE specifies the kind of DNS information requested for the domain name. QCLASS identifies the query’s class, while the domain name identifies the name to which the request applies.
For instance, a resolver might ask for one particular record kind associated with a chosen domain. Changing the QTYPE changes the information requested, even when the domain name remains the same.
04
4. Recursive and non-recursive requests
A resolver may ask a name server to pursue a query recursively by setting the RD request. This asks the responding server to continue the lookup instead of merely returning a direction for the next step.
When recursive service is provided, the name server returns an answer or an error rather than a referral. The resolver therefore receives a completed outcome from that server’s resolution attempt.
Non-recursive service works differently: the server handles the request without being required to complete the entire lookup. All name servers support non-recursive queries, so this mode remains available even when recursive support is not.
05
5. Reading recursive support
The RA response flag tells the resolver whether the responding name server offers recursive-query support. RD expresses what the request asks for; RA reports what the server makes available.
These flags answer different questions. A resolver can request recursion with RD, but the response’s RA value indicates whether that server supports handling the request recursively.
A useful diagnostic habit is to read both sides together: inspect the requested recursion setting, then check the server’s capability indication before assuming that the server completed the lookup.
06
6. Why resolvers cache results
A resolver’s local cache stores results from earlier DNS work. When a later request can be answered from that stored information, the resolver does not need to obtain the same result again from a name server.
Caching can reduce network delay and decrease the amount of work placed on name servers. Its value comes from reusing prior results for later requests.
Caching is not the same as asking a server again. A fresh lookup depends on a new exchange, while a cache-supported lookup may finish using information the resolver already retained.
07
7. Caching unsuccessful results
Caching can also apply to negative results, not only successful record responses. Negative-response caching allows name servers to distribute information about an unsuccessful result, and resolvers can retain that result for a time-to-live period.
This prevents every repeated request for the same unavailable information from requiring identical work immediately. The cached negative result remains governed by its TTL.
A negative response is different from an ordinary record answer because it reports that the requested information was not found, rather than supplying the requested record data.
08
8. Aliases and name errors
A CNAME response supplies a CNAME record and identifies a target name. After receiving it, the name server restarts the query using that target name, so resolution continues with the name selected by the alias.
A name-error response has a narrower meaning when returned by an authoritative name server: the queried domain name does not exist. This describes nonexistence of the queried name, not merely a referral to another server.
These outcomes should not be confused. A CNAME result redirects the lookup to another name, whereas an authoritative name error says that the queried domain name itself is absent.
09
9. Lesson recap
A resolver is the intermediary between user programs and DNS name servers. It formulates queries, uses server information or cached results, and needs access to at least one name server when a direct answer is required.
10
Query recap
A query’s domain name, QTYPE, and QCLASS identify the records being sought. QTYPE is the part that selects the requested kind of DNS information.
DNS resolution connects software that needs naming information with the name servers that hold or locate it. A resolver performs this connecting role, so an application can ask for DNS information without communicating with every name server itself.
A resolver builds a DNS query and sends it toward a name server able to provide the requested information. It must have access to at least one name server, either to receive the result directly or to continue through referrals.
A resolver may ask a name server to pursue a query recursively by setting the RD request. This asks the responding server to continue the lookup instead of merely returning a direction for the next step.