TCP-IP.NU

 Home



LMHOSTS / HOSTS, Software

Using the LMHOSTS file in Windows 95 for NetBIOS name resolution

When you use Microsoft TCP/IP on a local network with any combination of computers running Windows 95,
Windows NT, LAN Manager, or Windows for Workgroups server names are automatically matched to their
corresponding IP addresses. However, to match server names across remote networks connected by routers
(or gateways), you can use the LMHOSTS file if WINS servers are not available on the network.

The LMHOSTS file is commonly used to locate remote computers for Microsoft networking file, printer, and
remote access services, and for domain services such as logon, browsing, replication, and so on.

A network can be a multi-segment network using routers. If you are in one segment and you wish to print
through a computer in another segment, (a friend's or your office perhaps), use your LMHOSTS file to let your
computer know where that resource is.

Microsoft TCP/IP loads the LMHOSTS file into memory when the computer is started. The LMHOSTS file is a
text file in the Windows directory that lists the IP addresses and computer names of remote Windows
networking servers that you want to communicate with. The LMHOSTS file should list all the names and IP
addresses of the servers you regularly access.

For example, the LMHOSTS table file entry for a computer with an address of 192.53.63.2 and a NetBIOS
computer name of Building1 looks like this:

192.53.63.2 Building1


The format for the LMHOSTS file is the same as the format for host tables in 4.2 MSD UNIX systems. The
computer name is optionally enclosed in quotation marks (this is necessary for computer names that contain
spaces).

To create an LMHOSTS file:

Use a text editor to create a file named LMHOSTS, or edit the default file named LMHOSTS.SAM in the
Windows directory and then save this file as LMHOSTS.

In the LMHOSTS file, type the IP address and the host name of each computer that you want to communicate
with. Separate the items with at least one space. Entries in the LMHOSTS file are not case-sensitive.

You will want to use LMHOSTS for smaller networks, or to find hosts on remote networks that are not part of the
WINS database (because name query requests are not broadcast beyond the local subnetwork). If WINS
servers are in place on an internetwork, users do not have to rely on broadcast queries for name resolution,
because WINS is the preferred method for name resolution. Therefore, with WINS servers in place, LMHOSTS
may not be necessary.

However, the LMHOSTS file is read when WINS or broadcast name resolution fails, and resolved entries are
stored in a system cache for later access. When the computer uses the replicator service and does not use
WINS, LMHOSTS entries are required on import and export servers for any computers on different subnetworks
participating in the replication.