Home Up Contents

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:     myntdomsvr   #PRE     #DOM:mydomname     "mydomname       \0x1b"    #PRE     wrkstation1    #PRE     wrkstation2    #PRE     wrkstation2    #PRE

lmhosts example annotated     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 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.     "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.     wrkstation1    #PRE

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

See above.     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:     wrkstation1    #PRE     wrkstation2    #PRE     wrkstation2    #PRE



contact tcg
Last modified: January 16, 2002