LMHOSTS Files

The LMHOSTS file was introduced to assist with remote NetBIOS name resolution. The LMHOSTS file is a static, local database file that maps NetBIOS names to IP addresses. This is similar in functionality to the Hosts file in DNS, but the Hosts file is used for mapping IP addresses for host names in the hierarchical DNS namespace, rather than NetBIOS names. Recording a NetBIOS name and its IP address in the LMHOSTS file enables a node that cannot respond to name query broadcasts to resolve an IP address for that NetBIOS name.

When Windows 2000 uses an LMHOSTS file to resolve remote NetBIOS names, it examines the LMHOSTS file that is stored in the directory % SystemRoot %\System32\Drivers\Etc.

As noted earlier, a computer in a Microsoft-based network can resolve NetBIOS names in several different ways. If one method of resolution fails, the computer tries the next method in a fixed order. In a broadcast-based network, the node first checks its remote name cache before broadcasting a name query (the name will be in the cache if it has been used recently or loaded from LMHOSTS). As a last resort, the computer uses the LMHOSTS file to obtain the IP address assigned to the NetBIOS name it is trying to resolve (for example, to obtain the IP address for the name of a computer across a router in a broadcast-based network).

For more information about LMHOSTS files, see "LMHOSTS File" in this book.

Despite the many uses of the LMHOSTS file, its design imposes some limitations. Its greatest limitation is that it is a static file, which means that entries must be updated by hand if the name or the IP address of the computer changes (such as when a computer is moved to a new subnet, or when a remote user dials in and connects via Routing and Remote Access). This limitation of the LMHOSTS file is exacerbated by the introduction of DHCP. A DHCP server assigns IP addresses to nodes dynamically, making it nearly impossible to keep the LMHOSTS file updated.