Microsoft KB Archive/228760

= How to use a Hosts file to test a site that uses host headers on an Intranet =

Article ID: 228760

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft Internet Information Services 6.0
 * Microsoft Internet Information Services 5.1
 * Microsoft Internet Information Services 5.0
 * Microsoft Internet Information Server 4.0

-



This article was previously published under Q228760



We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 6.0 running on Microsoft Windows Server 2003. IIS 6.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:

http://www.microsoft.com/technet/security/prodtech/IIS.mspx



SUMMARY
This article describes how to use the Hosts file to test a site that uses a host header name over an intranet.

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:

190008 How to use host header names to host multiple sites from one IP address in IIS 5.0



MORE INFORMATION
If the computer that is running IIS and that contains the site that uses the host header name is located on an intranet (a private LAN that uses Internet technology), the host header name must be first be registered with the intranet's name resolution system, such as the Windows Internet Name Service (WINS), before it can be browsed to.

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 file
On 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:
 * 1) 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.
 * 1) On a local Windows NT computer, go to the %SystemRoot%\system32\drivers\etc directory and open the Hosts file in Notepad.
 * 2) On a blank line, type the IP address, followed by at least one space, and then the host header name of the site.
 * 3) 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 file
To 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 name
If 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.

Additional query words: web ftp hostheader Domain Name Server DNS WINS akz

Keywords: kbhowto KB228760

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.