Share via


Preload the DNS Client Resolver Cache

Applies To: Windows Server 2008

You can use this procedure to preload the Domain Name System (DNS) client resolver cache.

Entries that you add with this procedure are always answered first from the client’s local resolver cache. They are not sent to the DNS server when queries are made locally to resolve these names to host (A or AAAA) resource records.

Every line in the Hosts file contains an IP address, followed by one or more host names. For example, you can add a line, such as the following line, with an IP address (10.0.0.1) that maps to more than one DNS host name:

10.0.0.1  host-a  host-a.example.microsoft.com  host-b.example2.microsoft.com

Likewise, a single DNS host name can correspond to more than one IP address if each of the addresses is mapped and used in separate lines. For example, you can add lines for the following multihomed or multiaddressable DNS host computer:

10.0.0.1  host-a.example.microsoft.com
10.0.0.2  host-a.example.microsoft.com
10.0.0.3  host-a.example.microsoft.com

When multiple names or IP addresses are used in the Hosts file, the DNS Client service must be running for all entries to be returned or used in answering queries. If the DNS Client service is not running, only the first entry in the file is used to resolve the query.

Membership in Administrators, or equivalent, is the minimum required to complete this procedure. Review details about using the appropriate accounts and group memberships at Local and Domain Default Groups (https://go.microsoft.com/fwlink/?LinkId=83477).

To preload the DNS client resolver cache

  1. Open a command prompt. To open an elevated Command Prompt window, click Start, point to All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

    At the command prompt, type the following command, and then press ENTER:

    notepad %systemroot%\system32\drivers\etc\hosts
    
  2. Using the default entry in the file (a mapping for the local host to the loopback IP address, 127.0.0.1), add additional host-name-to-address mappings on separate lines to be preloaded into the resolver cache of the client. For example, you might add:

    10.0.0.1  host-a  host-a.example.microsoft.com

  3. On the File menu, click Save, and then Exit.

  4. As an option, you can verify that your changes have been updated in the resolver cache by viewing its contents.

Additional references