DOCUMENT:Q102725  26-AUG-1993  [W_NT]
TITLE   :LMHOSTS Block Commands in Windows NT
PRODUCT :Windows NT
PROD/VER:3.10
OPER/SYS:WINDOWS
KEYWORDS:

--------------------------------------------------------------------
The information in this article applies to:
 
 - Microsoft Windows NT operating system version 3.1
 - Microsoft Windows NT Advanced Server version 3.1
--------------------------------------------------------------------
 
The LMHOSTS file is used to resolve NetBIOS names to Internet Protocol
(IP) addresses. Windows NT provides new block commands that permit
centralized location and management of the LMHOSTS file. In addition,
provisions are included to permit redundant backup copies on multiple
servers.
 
MORE INFORMATION
================
 
The following Windows NT LMHOSTS file block commands are discussed in
detail below: 

 - #INCLUDE
 - #BEGIN_INCLUDE
 - #END_INCLUDE
 - #BEGIN_ALTERNATE
 - #END_ALTERNATE
 
Block Inclusion
---------------

130.20.26.169  Trustedserver  #PRE   #DOM:Testing  #Testing group domain
 
 #BEGIN_INCLUDE
 #INCLUDE \\localsrv\public\lmhosts       # This is in the local domain
 #INCLUDE \\Trustedserver\public\lmhosts  # This server is in TESTING domain
 #END_INCLUDE
 
In the above block inclusion, the specified LMHOSTS file is scanned
under the following conditions:

 - During TCP/IP initialization, the local LMHOSTS file is scanned for
   #PRE commands. It places all these entries in its name cache. In
   addition, all LMHOSTS files specified by the #INCLUDE command are
   scanned.

 - When resolving a computer name (NetBIOS name) to an IP address, the
   #INCLUDE file is also searched if the name cannot be found in the
   preloaded entries of the cache.

 - The LMHOSTS files are scanned to resolve the address of a domain
   controller of a domain that is not found in the preloaded cache name
   list.
 
The benefit of this command is that it allows system administrators to
easily maintain a centrally-located master LMHOSTS file that can be
accessed over the network by each node. This method also works across
subnets because of the use of UNC (universal naming convention) names
and LMHOSTS mappings for these entries.
 
If the domain spans multiple subnets or if the domain controller for a
domain is across a router, it is necessary to have an entry in the
LMHOSTS file for locating the domain controller for that server, with
a #DOM prefix added (for our example, trustedserver is the domain
controller for domain TESTING). See the IP line above the block
inclusion. This line must appear before the #INCLUDE.
 
In the above case, the TESTING domain has a trust relationship with
the local domain. This is important for servers included in the block
that are not in the local domain.
 
NOTE: The LMHOSTS files located on servers that are in a trusted
domain should have read privileges for the Everyone group, which
includes all of the local users and the trusted domain users.
 
Alternate Inclusion
-------------------

 #BEGIN_ALTERNATE
 #INCLUDE \\localsrv\public\lmhosts      # This is in a local domain
 #INCLUDE \\Trustedserver\public\lmhosts # This server is in TESTING Domain
 #END_ALTERNATE
 
In this case, the "Alternate Include" condition is satisfied if one of
the #INCLUDE's is successful. This means that only one LMHOSTS file
will be scanned. The first successful #INCLUDE is the only LMHOSTS
file that will be read.
 
This is helpful in keeping multiple copies of the same file on
different servers. If one of the servers is down, it will attempt to
read the LMHOSTS file from the alternate server identified in the
block inclusion.
 
REFERENCES
==========

Windows NT LMHOSTS File, Comments
"TCP/IP Internetworking on Windows NT" Technical Paper
 
Additional reference words: 3.10
KBCategory:
KBSubCatergory: tpip

=============================================================================

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.

Copyright Microsoft Corporation 1993.