Home Up Contents

lmhosts
lmhosts hosts

 

lmhosts file

Remember: the lmhosts file equates the IP address with the NetBIOS name for the Microsoft Networking functions such as browsing, drive mapping, file and print sharing, etc. It is the static version of a WINS server and is practically mandatory for optimal operation in the absence of a WINS server (a service that runs under NT server only).

Like the hosts file, lmhosts is placed in the \windows folder for Windows for Workgroups 3.11, Windows 95/98 systems and placed in the \winnt\system32\drivers\etc folder for Windows NT systems. It must not have a file extension such as ".txt". It is named just plain "lmhosts". Place a copy on every system.

lmhosts example 1

With an NT domain the lmhosts file will resemble this:

192.168.12.1     myntdomsvr   #PRE     #DOM:mydomname
192.168.12.1     "mydomname       \0x1b"    #PRE
192.168.12.2     wrkstation1    #PRE
192.168.12.3     wrkstation2    #PRE
192.168.12.4     wrkstation2    #PRE

lmhosts example annotated

192.168.12.1     myntdomsvr   #PRE     #DOM:mydomname

This line represents an NT Server PDC (Primary Domain Controller) with the NetBIOS name of myntdomsvr, an NT domain name of mydomname and an assigned IP address of 192.168.12.1. The #PRE flag causes preloading during system startup eliminating the need for the system to examine the lmhosts file for those preloaded items thereby improving performance. It's fairly typical to use the #PRE flag for all entries on smaller networks (the preloaded information is stored in memory and for large networks this may not be ideal) and especially for all servers or those systems acting as servers, i.e. sharing files or printers. The #DOM flag is only used for the NT domain controller. It is imperative that the #PRE and #DOM flags be capitalized.

192.168.12.1     "mydomname       \0x1b"    #PRE

This statement is needed in the lmhosts file of systems that do not perform the NetGetDcName API, currently Windows for Workgroups 3.11 and Windows 95 systems, to allow the client browser service to explicitly find the PDC defined above. The tricky part is that there must be exactly 15 characters between the open quote and the backslash, the domain name starts immediately after the open quote and spaces pad to the backslash for the total 15 characters. These first two lines will not be used in networks without an NT PDC.

192.168.12.2     wrkstation1    #PRE

Standard workstation entry stating the IP address (192.168.12.2) and NetBIOS name (wrkstation1) of this workstation, then preloading it (#PRE). For non-NT domain networks these will be the standard entries.

192.168.12.3     wrkstation2    #PRE

See above.

192.168.12.4     wrkstation2    #PRE

Important! You don't see it here but be sure to hit "enter" after typing in the last entry as the file must terminate with a carriage return.

lmhosts example 2

With no NT domain (peer-to-peer) the lmhosts will resemble this:

192.168.12.2     wrkstation1    #PRE
192.168.12.3     wrkstation2    #PRE
192.168.12.4     wrkstation2    #PRE

 

 

 
contact tcg
Last modified: January 16, 2002