共用方式為


Preload the client resolver cache

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

To preload the client resolver cache

  1. At the client computer, open Command Prompt.

  2. At the command prompt, type the following command:

    notepad %systemroot%\system32\drivers\etc\hosts

  3. 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

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

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

Notes

  • To perform this procedure, you must be a member of the Administrators group on the local computer, or you must have been delegated the appropriate authority. If the computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. As a security best practice, consider using Run as to perform this procedure.

  • To open a command prompt, click Start, point to All programs, point to Accessories, and then click Command prompt.

  • To open Notepad, click Start, point to All programs, point to Accessories, and then click Notepad.

  • Entries you add are always answered first from the local resolver cache and not sent to the DNS query when queries are made locally to resolve these names to host (A) resource records.

  • Every line in the Hosts file should contain an IP address followed by one or more host names. For example, you could add a line such as the following 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 could add lines for the following multi-homed or multi-addressable 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 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.

Information about functional differences

  • Your server might function differently based on the version and edition of the operating system that is installed, your account permissions, and your menu settings. For more information, see Viewing Help on the Web.

See Also

Concepts

How DNS query works
Display and view a client resolver cache using the ipconfig command
Client features