Differences Between the HOSTS and LMHOSTS Files in Windows NT

Last reviewed: May 12, 1997
Article ID: Q105997

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

SUMMARY

In Windows NT, the HOSTS file is for TCP/IP utilities, and the LMHOSTS file is for LAN Manager NET utilities. If you cannot PING another computer (using a friendly name), check the HOSTS file. If you cannot NET VIEW a server using only the TCP/IP protocol, check the LMHOSTS file.

MORE INFORMATION

The HOSTS file is used when you do something with the TCP/IP utilities, such as PING, FTP, and TELNET. You can find the HOSTS file in the winnt\system32\drivers\etc directory. The format of the file is the following:

   IP Address     Friendly Name

   130.25.25.87   jsmith_nt   # Remarks are denoted with a #.

With an entry like this in the HOSTS file, you could PING jsmith instead of typing out the whole IP address (ping 130.25.25.87). This file is NOT dynamic, so you need to add entries manually.

The LMHOSTS file is for LAN Manager name resolution with the TCP/IP protocol. The file is similar in format to the HOSTS file, but its function is to resolve IP addresses for a server that is not on the local subnet (the same wire). So, if you type the following

   NET VIEW \\JSMITH_NT

and JSMITH_NT is on a different subnet, you will receive a "Server not Found" error message. If you are on a different subnet, edit your LMHOSTS file (in the same directory as the HOSTS file) to read as follows:

   IP Address     Friendly Name

   130.25.25.87   jsmith_nt

So when you type "NET VIEW \\JSMITH_NT" (without the quotation marks), the LMHOSTS file tells Windows NT to replace the "\\jsmith_nt" with the IP address to resolve where the server is.

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

   lmhosts and windows and nt


Additional query words: prodnt
Keywords : kbnetwork ntnetserv 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.