Rules for LMHOSTS

Use the following rules for entries in LMHOSTS:

Note

With Microsoft networks, a NetBIOS computer name displayed within straight quotation marks that is less than 16 characters long is padded with spaces. If you do not want this behavior, make sure the quoted string is 16 characters long.

The keywords listed in the following table can be used in LMHOSTS under Windows NT. (LAN Manager 2.x, which also uses LMHOSTS for NetBIOS over TCP/IP name resolution, treats these keywords as comments.)

Table 15.1 LMHOSTS Keywords

Keyword

Description

#PRE

Added after an entry to cause that entry to be preloaded into the name cache. By default, entries are not preloaded into the name cache but are parsed only after WINS and name query broadcasts fail to resolve a name. The #PRE keyword must be appended for entries that also appear in #INCLUDE statements; otherwise, the entry in #INCLUDE is ignored.

#DOM:<domain>

Added after an entry to associate that entry with the domain specified by <domain>. This keyword affects how the Browser and Logon services behave in routed TCP/IP environments. To preload a #DOM entry, you must also add the #PRE keyword to the line.

#INCLUDE <filename>

Forces the system to seek the specified <filename> and parse it as if it were local. Specifying a Uniform Naming Convention (UNC) <filename> allows you to use a centralized LMHOSTS file on a server. If the server is located outside of the local broadcast area, you must add a mapping for the server before its entry in the #INCLUDE section and also append the #PRE keyword to ensure that it preloaded.

#BEGIN_ALTERNATE

Used to group multiple #INCLUDE statements. Any single successful #INCLUDE causes the group to succeed.

#END_ALTERNATE

Used to mark the end of an #INCLUDE statement grouping.

\0xnn

Support for nonprinting characters in NetBIOS names. Enclose the NetBIOS name in double quotation marks and use \0xnn notation to specify a hexadecimal value for the character. This allows custom applications that use special names to function properly in routed topologies. However, LAN Manager TCP/IP does not recognize the hexadecimal format, so you surrender backward compatibility if you use this feature.

Note that the hexadecimal notation applies only to one character in the name. The name should be padded with blanks so the special character is last in the string (character 16).


The following example shows how all of these keywords are used:



102.54.94.98 localsrv #PRE 102.54.94.97 trey #PRE #DOM:networking #net group's PDC 102.54.94.102 "appname \0x14" #special app server 102.54.94.123 popular #PRE #source server #BEGIN_ALTERNATE #INCLUDE \\localsrv\public\lmhosts #adds LMHOSTS from this server #INCLUDE \\trey\public\lmhosts #adds LMHOSTS from this server #END_ALTERNATE

In the above example: