Resolving NetBIOS Names Using Lmhosts
In the early days of NetBIOS, Microsoft borrowed an idea from UNIX for resolving host names using a static lookup file. UNIX hosts were resolved using a Hosts file, and because the Microsoft team was working on OS/2 LAN Manager at the time, the NetBIOS name lookup table was called Lmhosts. Neither filename has an extension.
Configuring Lmhosts
The idea behind Lmhosts is to have a place where Netbt.sys can resolve a name without broadcasting. The file is a plain ASCII text file consisting of IP addresses and host names. Here is an example listing three servers, two of which are domain controllers in a domain called COMPANY:
# Lmhosts file for Domain COMPANY
10.1.1.10 DC01 #PRE #DOM:COMPANY
10.1.1.20 DC02 #PRE #DOM:COMPANY
10.1.1.30 PRO3 #PRE
10.1.1.100 PRO4 #PRE
#BEGIN_ALTERNATE
#INCLUDE \\PRO3\PUBLIC\ETC\Lmhosts
#INCLUDE \\DC02\PUBLIC\ETC\Lmhosts
#END_ALTERNATE
The pound sign (#) has two functions:
- Precedes a standard Lmhosts parameter such as #PRE, #DOM, and #INCLUDE
- If not followed by a recognized parameter, indicates a remark, such as that used in the first line
Here are the standard Lmhosts parameters. The name must be uppercase, otherwise the entry is considered a remark:
- #PRE .
This parameter tells the system to load the associated entry into the NetBIOS name cache at boot time. This speeds up initial name lookups. - #DOM .
This parameter flags the entry as a domain controller with the name after the colon being the domain name. If you use Lmhosts in a domain environment, this switch is a necessity because it tells the local client where to go to get authenticated. - #INCLUDE .
Tells Tcpip.sys to load the Lmhosts file from another computer. The #INCLUDE option enables you to maintain a single, central Lmhosts file that can be referenced by other workstations in a workgroup. The entry uses a UNC name, such as \\SRV1\Public, where Public is a share name. There is a subtle Catch-22 at work here. The UNC path contains a NetBIOS name, so you must make sure the local Lmhosts file has an entry for that name. - #BEGIN_ALTERNATE and #END_ALTERNATE .
Use these statements to bracket multiple entries under a single #INCLUDE statement. If you have only one #INCLUDE statement, you do not need bracketing statements.
Using Lmhosts
Lmhosts