DNS Queries and Lookups in Windows and W·续

The following steps describe the process of querying a DNS server:

  1. If the query is a fully qualified domain name (FQDN), meaning it ends with a terminating dot (.) then the query is submitted to the DNS server. For example, www.contoso.com.

  2. If the query is an unqualified multi-label query, meaning it doesn't end with a terminating dot (.), the DNS client submits it to the DNS server with a terminating dot (.). For example, www.contoso.com.

  3. If the unqualified is single label query such as www . Then the behavior is different based on the DNS settings on the NIC.

  4. If there a DNS suffix search list then the DNS client service appends them in order from first to last to the single label query and submit the query with terminated dot (.) to the DNS server. This process is a repeated process until all DNS suffix search list used.

  5. If no DNS suffix search list is configured, then the DNS client service appends primary DNS suffix to the single label query with terminated dot (.) and submit to the DNS server.

When the DNS client is configured to perform name devolution, it devolves the primary DNS suffix and send another query with a terminating dot (.) if the primary DNS suffix fails. For example, if resolve www.test.contoso.com fails the client devolves to www.contoso.com

  1. If there's a connections-specific DNS suffix configured on the adapters, it appends the query with terminated dot (.) and submitted to the DNS server.

In all cases, the response is stored in the DNS client cache, regardless of whether the response is positive or negative.

The following flowchart illustrates the described process of querying a DNS server.

A flowchart illustrating the process of querying a DNS server.

DNS recursion

Consider the use of the recursion process to locate the name host-b.example.contoso.com. when the client queries a single DNS server. The process occurs when a DNS server and client are first started and have no locally cached information available to help resolve a name query. It assumes that the name queried by the client is for a domain name of which the server has no local knowledge, based on its configured zones.

First, the preferred server parses the full name and determines that it needs the location of the server that is authoritative for the top-level domain, com. It then uses an iterative query to the com DNS server to obtain a referral to the contoso.com server. Next, a referral answer comes from the contoso.com server to the DNS server for example.contoso.com.

Finally, the example.contoso.com. server is contacted. Because this server contains the queried name as part of its configured zones, it responds authoritatively back to the original server that initiated recursion. When the original server receives the response, it checks if the answer is authoritative. If it is, the server forwards this answer back to the requesting client, completing the recursive query process.

Although the recursive query process can be resource-intensive when performed as described, it has some performance advantages for the DNS server. For example, during the recursion process, the DNS server performing the recursive lookup obtains information about the DNS domain namespace. The server caches the information, which can be used again to help speedup answering of subsequent queries that use or match it. Over time, this cached information can grow to occupy a significant portion of server memory resources. The cache is cleared whenever the DNS service is restarted.

DNS query adaptive time-out

The DNS query adaptive time-out feature enables the time-out for DNS queries to adapt based on the time required for previous queries, reducing the time out for most queries. Time-outs can also be increased for high-latency links, such as satellite links. Windows Store apps can optimize the configuration of DNS time-outs on a per network interface basis.

Instead of waiting for 1,000 ms before timing out a DNS query, the first time out is adjusted to be between 25 ms and 1,000 ms, based on past performance of the network.

DNS server nonresponsive cache

Nonresponsive DNS servers are cached and periodically retried. This retirement enables the DNS client to use the best available server consistently, and to spend less time waiting for unresponsive DNS servers.

The following figure shows example DNS client queries each server on each adapter using the process in this section.

Diagram that shows the DNS multihomed name resolution queries for each server on each adapter.

The DNS Client service queries the DNS servers in the following sequence:

  1. The DNS Client service sends the name query to the first DNS server on the preferred adapter’s list of DNS servers and waits one second for a response.

  2. If the DNS Client service doesn't receive a response from the first DNS server within one second, it sends the name query to the first DNS servers on all adapters that are still under consideration and waits two seconds for a response.

  3. If the DNS Client service doesn't receive a response from any DNS server within two seconds, it sends the query to all DNS servers on all adapters that are still under consideration. The DNS Client service then waits another two seconds for a response.

  4. If the DNS Client service still doesn't receive a response from any DNS server, it sends the name query to all DNS servers on all adapters that are still under consideration and waits four seconds for a response.

  5. If the DNS Client service doesn't receive a response from any DNS server, the DNS client sends the query to all DNS servers on all adapters that are still under consideration and waits eight seconds for a response.

  6. If the DNS Client service doesn't receive a response from any server within eight seconds, the DNS Client service responds with a time out. If the DNS Client service doesn't receive a response from any DNS server on specific adapter, it times out all queries to those servers for the next 30 seconds on that adapter.

  7. If at any point the DNS Client service receives a negative response from a server, it removes every server on that adapter from consideration during this search. For example, if the first server on Alternate Adapter A gives a negative response in step 2, the DNS Client service doesn't query any other server on the list for Alternate Adapter A.

  8. If the DNS Client service receives a positive response, it stops querying for the name, adds the response to the cache, and returns the response to the client.

The DNS Client service keeps track of which servers answer name queries more quickly, and it moves servers up or down on the list based on how quickly they reply to name queries.

Alternate query responses

The preceding description of DNS queries assumes that the process ends with a positive response returned to the client. However, queries can return other answers as well. The following are the most common query answers:

  • An authoritative answer

  • A positive answer

  • A referral answer

  • A negative answer

An authoritative answer is a positive response from a DNS server that has direct authority over the queried name. This answer includes the authority bit set in the DNS message to indicate its authenticity.

A positive response can consist of the queried RR or a list of RRs (also known as a RR set) that fits the queried DNS domain name and record type specified in the query message.

A referral answer contains other RRs not specified by name or type in the query. This type of answer is returned to the client if the recursion process isn't supported. The records are meant to act as helpful reference answers that the client can use to continue the query using iteration. A referral answer contains more data such as RRs that are other than the type queried. For example, if the DNS server doesn't find any A RRs for the queried host name www in this zone, but it finds a CNAME RR for www instead, it can include that information in its response to the client. If the client is able to use iteration, it can make more queries using the referral information in an attempt to fully resolve the name for itself.

A negative response from the server can indicate one of two possible results:

  • The authoritative server couldn't find the queried name in the DNS namespace.

  • The authoritative server found the queried name, but no records of the specified type exist for that name.

The resolver processes the query and returns the results to the requesting program. The response can be either positive or negative. Additionally, the resolver caches the response for future use.

If the resultant answer to a query is too long to be sent and resolved in a single UDP message packet, the DNS server can initiate a failover response over TCP port 53 to answer the client fully in a TCP connected session.

Disabling the use of recursion on a DNS server is done when DNS clients are being limited to resolving names to a specific DNS server, such as one located on your intranet. Recursion might also be disabled when the DNS server can't resolve external DNS names. In this case, clients are expected to fail over to another DNS server for name resolution. If you disable recursion on the DNS server, you can't use forwarders on the same server.

By default, DNS servers use several default timings when performing a recursive query and contacting other DNS servers. These defaults include:

  • A recursion retries interval of 3 seconds. This interval is the length of time the DNS service waits before retrying a query made during a recursive lookup.

  • A recursion time-out interval of 8 seconds. This interval is the length of time the DNS service waits before failing a recursive lookup that has been retried.

Under most circumstances, these parameters don't need adjustment. However, if you're using recursive lookups over a slow-speed wide area network (WAN) link, you might be able to improve server performance and query completion by making slight adjustments to the settings.