This article is divided into the following sections:
- Comprehensive Information
- LMHOSTS Entry Cache
- Predefined Keywords
- More Information on Block Inclusion
- 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 valuable additions to the LAN Manager and Windows for Workgroups LMHOSTS file, such as the ability to support routed domain logon validation.
- LMHOSTS 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.
- By default, the LMHOSTS file should be located in the directory %SYSTEMROOT%\SYSTEM32\DRIVERS\ETC (usually C:\WINNT\SYSTEM32\DRIVERS\ETC).
LMHOSTS Entry CacheBy default, entries specified with the #PRE keyword are cached at initialization up to a maximum of 100 entries. More initially cached entries can be obtained modifying the following Registry value:
Predefined KeywordsAll predefined keywords that are valid for Windows and Windows Advanced Server computers are not valid for LMHOSTS files on Microsoft LAN Manager or Microsoft Windows for Workgroups computers. These computers can't be validated by routed domain controllers the same way Windows NT computers can. To be able to validate them, use the LAN Manager TCP/IP Extensions Service available on all OS/2 LAN Manager (version 2.1a or later) servers.
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
Associates a single, unique NetBios computer name to an IP address.
You can create multiple entries for the same NetBios computer name
for each NIC in the multihomed device, up to a maximum of 25 different
IP addresses for the same name.
126.96.36.199 rhinodc #PRE #DOM:rhino #PDC for rhino domainNOTE: PDC is primary domain controller and BDC is backup domain controller.
188.8.131.52 zoobdc #PRE #DOM:rhino #BDC for rhino domain
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 the file is accessed in sequential order.
More Information on Block Inclusion KeywordsWindows 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. The following Windows LMHOSTS file block commands are discussed in detail below:
184.108.40.206 Trustedserver #PRE #DOM:Testing # Test group domain
In the above block inclusion, the specified LMHOSTS file is scanned under the following conditions:
#INCLUDE \\localsrv\public\lmhosts # Local domain
#INCLUDE \\Trustedserver\public\lmhosts # Server in Testing domain
- 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.
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 Block Inclusion (#BEGIN_ALTERNATE, #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.
#INCLUDE \\localsrv\public\lmhosts # Local domain
#INCLUDE \\Trustedserver\public\lmhosts # Server in Testing Domain
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.
Additional information, including a full description of all these features, is available in the Windows Resource Kit.
ID članka: 102725 – Zadnji pregled: 19. feb. 2007 – Revizija: 1