LMHOSTS File

Previous Topic Next Topic

Using the LMHOSTS File to Find Computers and Services

Windows 2000 and Microsoft® Windows NT® versions 4.0 and 3.5x provide name resolution services for both NetBIOS computer names and Domain Name System (DNS) host names on TCP/IP networks. For information about name resolution through WINS, and LMHost files, see "Windows Internet Name Service" in this book. For information about name resolution through DNS, see "Windows 2000 DNS" in this book.

Using the LMHOSTS file is one method of name resolution for NetBIOS names in TCP/IP networks. Depending on the computer's configuration, the following methods might also be used to resolve NetBIOS names on a TCP/IP network:


note-icon

Note

NetBIOS over TCP/IP (NetBT) is defined by Internet Engineering Task Force RFCs 1001 and 1002. These RFCs define the different name resolution modes-broadcast, point-to-point, mixed, and hybrid-that a computer uses to resolve IP addresses from NetBIOS names.

By installation default, a Windows 2000–based computer not configured as a WINS client or WINS server uses broadcast mode for name resolution and is called a B node. A B node is a computer that uses IP broadcasts for NetBIOS name resolution.

IP broadcast name resolution can provide dynamic name resolution. However, the disadvantages of broadcast name queries include increased network traffic and ineffectiveness in routed networks. Resources located outside the local subnet do not receive IP broadcast name query requests because, by definition, IP-level broadcasts are not passed to remote subnets by the router (default gateway) on the local subnet.

As an alternate method to IP broadcasts, Windows 2000 enables you to manually map NetBIOS names to IP addresses for remote computers by using the LMHOSTS file. Selected mappings from the LMHOSTS file are maintained in a limited cache of mappings. This memory cache is initialized when a computer is started. When the computer needs to resolve a name, the cache is examined first and, if there is no match in the cache, Windows 2000 uses broadcast mode IP broadcasts to try to find the NetBIOS computer. If the IP broadcast name query fails, the computer parses the complete LMHOSTS file (not just the cache) to find the NetBIOS name and the corresponding IP address. This strategy enables the LMHOSTS file to contain a large number of mappings without requiring a large chunk of static memory to maintain an infrequently used cache. Then, if the computer cannot resolve the name with the LMHOSTS file, the computer uses DNS for name resolution.

The LMHOSTS file can be used to map computer names and IP addresses for computers outside the local subnet (an advantage over the broadcast method). You can use the LMHOSTS file to find remote computers for network file, print, and remote procedure services and for domain services, such as logging on, browsing, and replication.

The Windows 2000–based LMHOSTS method of name resolution is compatible with the TCP/IP LMHOSTS files of Microsoft® LAN Manager 2.x.

© 1985-2000 Microsoft Corporation. All rights reserved.