LMHOSTS File Information and Predefined Keywords
PSS ID Number: Q107493
Article last modified on 11-30-1993
PSS database name: W_NT

3.10

WINDOWS


--------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Windows NT operating system, version 3.1
- Microsoft Windows NT Advanced Server, version 3.1
--------------------------------------------------------------------------

SUMMARY
=======

The LMHOSTS file is a local text file that maps IP addresses to NetBIOS
names of remote servers with which you want to communicate over the TCP/IP
protocol. By default the file should be located in the %windir%\SYSTEM32
subdirectory.

Windows NT recognizes names instead of IP addresses for network requests
and a name discovery process is used to correctly route network requests
with TCP/IP. Because the name discovery process is generally not routed by
an IP router, the LMHOSTS file allows Windows NT computers to communicate
using TCP/IP across a subnet.

Comprehensive Information
-------------------------

 - LMHOSTS contains IP address to "NetBIOS over TCP/IP" name translations.
 - LMHOSTS is only used by the NBT (NetBIOS over TCP/IP) interface.
 - LMHOSTS file contains some worth full additions to the LAN Manager and
   WFWG LMHOSTS file, like the ability to support routed domain logon
   validation.
 - Contains static information about TCP/IP addresses, but using logon
   scripts and/or the replicator service the "master" file can be
   distributed transparently across all stations.

LMHOST Entry Cache
------------------

 - By default, only entries specified with keyword #PRE will be cached at
   initialization, up to a maximum of 100 entries by default. More initial
   "#PRE" cached entries can be obtained modifying the following registry
   key value:

      \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NBT\Parameters\
      MaxPreload as type REG_WORD.

 - Any entries beyond will be resolved after b-node broadcast fails.

 - The sequence used to determine NetBIOS to IP address resolution is the
   following: first, the cache is verified, then a broadcast to the subnet
   is done, and third, additional entries from LMHOSTS are looked up. If
   the connection has not been established within 15 seconds, the TDI will
   time-out and an error message will be displayed.

Predefined Keywords
-------------------

All predefined keywords are valid for Windows NT and Windows NT Advanced
Server workstations, and not for LAN Manager and/or Windows for Workgroups
LMHOSTS files. Therefore, those workstations cannot be validated by routed
domain controllers, the same way Windows NT and Windows NT Advnaced Server
machines can. To validate those workstations, use the LAN Manager TCP/IP
Extensions Service available on all OS/2 LAN Manager servers versions 2.1a
and later.

 - # <"remark line">
   Used to remark IP address to NetBIOS names.
 - #PRE
   Defines which entries should be initially preloaded into the name cache.
 - #DOM:<"domain_name">
   Distinguishes Windows NT Advanced Server DC's (PDC and Backups) from
   Windows NT workstations, a LAN Manager server, or a Windows for
   Workgroups system. This keyword is needed for all DCs who validate logon
   requests.
 - #NOFNR
   Avoid Directed Name Queries (DNS). Some earlier versions of LAN Manager
   can't handle NetBIOS DNS requests and return error 53. Specifying this
   flag on the same line will avoid using NetBIOS directed name queries.
 - #BEGIN_ALTERNATE
   #INCLUDE <\\"server_name01"\"sharename"\LMHOSTS>
   #INCLUDE <\\"server_name02"\"sharename"\LMHOSTS>
 - #END_ALTERNATE
   Defines a redundant list of alternate locations for LMHOSTS files. The
   recommended way to #INCLUDE remote files is using a UNC path, to ensure
   access to the file. Of course, the UNC names must exist in the LMHOSTS
   file with a proper IP address to NetBIOS name translation.

The first three keywords can be used together to specify 1 NetBIOS over
TCP/IP name to IP address translation.

Example
-------

102.54.94.97     rhinodc     #DOM:rhino     #The rhino domain PDC     #PRE
102.54.94.99     zoobdc     #DOM:rhine     #BDC for rhino domain     #PRE

It is important to start with the IP Address followed by the NetBIOS name.
The predefined entries can be defined in diverse order. It is recommended
to insert important entries first, because the file is accessed in
sequential order.

Additional information, including a full description of all these features
can be obtained from the Windows NT Resource Kit.

Additional reference words: 3.10 LMHOSTS KEYWORDS

Copyright Microsoft Corporation 1993.