Preload the DNS client resolver cache

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Entries that you add with this procedure are always answered first from the local resolver cache. They are not sent to the Domain Name System (DNS) query when queries are made locally to resolve these names to host address (A) resource records.

Every line in the Hosts file contains an Internet Protocol (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.

To preload the DNS client resolver cache

  1. At a 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.