Caution Modifying the Hosts file on your computer incorrectly can interfere with name resolution. Be sure to make a backup copy of the Hosts file before modifying it. After testing that the new site that uses a host header name is working properly, you may want to return your Hosts file back to its original form.
Also, if your intranet uses Dynamic Host Configuration Protocol (DHCP) to dynamically assign IP address to computers, keep in mind that the IP addresses can change, and therefore the IP address referred to in your Hosts file may eventually belong to another computer.
For more information about how to use host header names on a computer that is running IIS, click the following article number to view the article in the Microsoft Knowledge Base:
In order to test the site immediately (without waiting for the intranet's administrator to update the name resolution system), modify the Hosts file of the computer you plan to browse from.
Add entry for host header name site to Hosts fileOn a local Windows NT computer, perform the following steps to update the Hosts file, so that requests for the site using the host header name are routed to the correct IP address:
- At a command prompt, type PING IIS-ServerName, where "IIS-ServerName" is the name of the IIS computer that contains the site using the host header name.
The reply from the PING command contains the IP address of the IIS computer. Record this IP address.
- On a local Windows NT computer, go to the %SystemRoot%\system32\drivers\etc directory and open the Hosts file in Notepad.
- On a blank line, type the IP address, followed by at least one space, and then the host header name of the site.
- Save the Hosts file.
Note This file should not have a file name extension. In other words, the file name should simply be Hosts.
Test the Hosts fileTo make sure the Hosts file is working properly, go to a command prompt, and type PING HostHeaderName, where "HostHeaderName" is the host header name used by the new site.
The reply should contain the same IP address that was returned earlier when Pinging the IIS computer.
Browse the site by using the host header nameIf the PING was successful, indicating that the intranet is routing connections to the host header name to the IIS computer, use a Web browser to load the new site, using the host header name.
(c) Microsoft Corporation 2000, All Rights Reserved. Contributions by Kevin Zollman, Microsoft Corporation.
ID d'article : 228760 - Dernière mise à jour : 30 juil. 2008 - Révision : 1