The organization of the cached data

The cache is contained in one physical location that has separate logical structures for forward and reverse lookup information. The cache data is organized by DNS name server, which permits different name servers to provide different values for a given host name or IP address.

For example, consider the installation shown in Figure 1. There are two TCP stacks; one TCP stack is used for the core production processing, and a second TCP stack is used for test purposes only. The stacks use different name servers to isolate test resources from the production environment. Each name server can potentially have different IPv4 (A record) definitions for the same host name, as is the case for host.ibm.com. If the test application issues a query for host.ibm.com, the test TCP stack directs the request to the test name server, and IP address 10.45.5.5 is obtained. If the production application issues the same query, a different IP address (10.145.5.5) is obtained. The resolver caches both responses but remembers which response was received from which name server, so that a subsequent request from the test application for host.ibm.com returns the correct test IP address, and not the production IP address.

Figure 1. Resolver caching process; each stack specifies one NSINTERRADDR value
Caching when each stack has different NSINTERADDR value;queries for host.ibm.com result in different IP addr for stacks

The resolver performs cache lookups using the NSINTERADDR search order list in the TCPIP.DATA data set. In Figure 1, each stack specifies a single NSINTERADDR value. More likely, in reality, multiple NSINTERADDR definitions are provided, as shown in Figure 2. In this example installation, if the primary name server is unavailable, a secondary name server is used instead. The resolver considers a cache entry that is associated with any name server in the NSINTERADDR list as a match for the target host name; the name resolution is complete and no DNS queries are sent to any of the name servers. The resolver searches the cache in the order that the name servers appear in the NSINTERADDR list; if multiple entries exist for the same target host name (one from each of the name servers in the NSINTERADDR list), the information provided by the first name server in the list is used. In Figure 2, if the test application issues a query for host.ibm.com, IP address 10.145.5.5 is obtained because the first name server IP address in the list is now the production name server (10.6.6.6). If the production application issues the same query, the same IP address, 10.145.5.5 is obtained because there is no entry in the cache for host.ibm.com from the first name server in the list, but there is cache information from the second name server (which is, again, 10.6.6.6).

Figure 2. Resolver caching process; each stack specifies multiple NSINTERRADDR values
The resolver caching process and query results when each stack specifies multiple NSINTERRADDR values.

IPv4 information and IPv6 information are cached as separate entries. A maximum of 35 IP addresses is saved per host name for each name server that provides data for that host name.

Tip: Resolver caching does not provide round-robin support for response data. DNS servers can be configured to use a round-robin method for ordering the IP addresses that are returned by queries, but the resolver always caches the information in the order in which it was received, and returns the IP addresses in the same order, as long as cache information is still valid.