Cannot PING Computer on Last Line of HOSTS File

Last reviewed: May 12, 1997
Article ID: Q105998

The information in this article applies to:
  • Microsoft Windows NT operating system version 3.1
  • Microsoft Windows NT Advanced Server version 3.1

SYMPTOMS

If you add an entry to the HOSTS file (for TCP/IP utilities) and then try to use the PING command to access that computer, you may receive the following error message:

   <friendlyname>:Unknown Host

CAUSE

This error message may be caused by not having a carriage return after the last line in the HOSTS file. This problem usually occurs only when you try to communicate with the computer on the last line of the HOSTS file, because the other lines should have carriage returns.

NOTE: There may be numerous other causes for this error message.

RESOLUTION

To avoid this error message, use Notepad (or any text editor) to edit the HOSTS file and add a carriage return to the last line. If you add a carriage return to the last line of the HOSTS file created above, the PING command works correctly.

For additional information on the HOSTS file in Windows NT, query on the following words in the Microsoft Knowledge Base:

   hosts and windows and nt

For additional information on the troubleshooting TCP/IP connectivity with Windows NT, query on the following words in the Microsoft Knowledge Base:

   tcp/ip and tshoot and windows and nt

MORE INFORMATION

Steps to Reproduce Problem

  1. Rename the HOSTS file in the winnt\system32\drivers\etc\ directory to HOSTS.OLD.

    NOTE: After testing, be sure to rename HOSTS.OLD back to HOSTS.

  2. Using Notepad, create a new HOSTS file with the following line:

       127.0.0.1   test
    
       (Without a carriage return after "test.")
    
    

  3. Save the file as HOSTS in the winnt\system32\drivers\etc\ directory.

  4. Open a Command Prompt and enter the following command:

          ping test
    

You will receive the above error message.


Additional query words: prodnt
Keywords : kbnetwork NTSrvWkst nttcp
Version : 3.1
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.