University of Colorado at Boulder    
Map A to Z Index Search CU Home
ITS logo
Information Technology Services News | ITS Search
UCB Windows 2000 Resource Center

 
Learn More
Site Overview
Project Description
UCB W2K FAQ
Campus Windows 2000 Administrators Guide
Project Updates
ITS Windows 2000 Resouces
Microsoft Windows 2000 Resources
Windows 2000 Projects at other schools


Learn More
Other ITS Pages
  ITS Projects and Initiatives

 

Proper LMHOSTS file formatting

NetBIOS Naming

Much of Windows networking relies on NetBIOS naming to identify and locate resources.  There are several methods for clients to get NetBIOS information including broadcasts, WINS services, and LMHOSTS files.  Without the use of WINS services or LMHOSTS files, a client makes broadcasts to locate computers via their NetBIOS name; unfortunately this method is inherently restricted to locating computers within the same subnet as the client. 

WINS

WINS is a centralized service that allows computers to both register their NetBIOS name and their IP address as well as query for the IP address of other NetBIOS names.  WINS servers not only register information on computer NetBIOS names, but they also register special entries for Windows domains, domain controllers, and other special functions.  This service allows clients to readily locate resources on other subnets by their NetBIOS names.  It also allows supports changing IP addresses for computers registering so they can be located even when using DHCP to obtain an IP address.

LMHOSTS Files

LMHOSTS files are static mappings of NetBIOS names to IP addresses, they are often used when resources must be located by NetBIOS names, but WINS is not available.  With the exception listed below, a client using an LMHOSTS file will first attempt a broadcast location, then fallback to looking up the entry in its LMHOSTS file.  Like WINS, LMHOSTS files can have special entries for domains and domain controllers, but these require careful configuration. 

The LMHOSTS file is located in the %SystemRoot%\System32\Drivers\Etc folder on a Windows computer along with an LMHOSTS.sam sample file.  A new install of Windows will only have the sample file present. 

An LMHOSTS entry for a standard computer (not a domain controller or master browser) would look like this:

nnn.nnn.nnn.nnn   <computername>   #comment

An LMHOSTS entry can be preloaded using the PRE keyword making the client use the IP address given in the entry before attempting a broadcast.  Such an entry would look like this:

nnn.nnn.nnn.nnn   <computername>   #PRE #comment

An entry for a domain controller is marked using the DOM keyword.  For example a preloaded entry for a domain controller (PDC or BDC in NT 4) for a domain called "frogs" would look like this:

nnn.nnn.nnn.nnn   <computername>   #PRE   #DOM:FROGS  #comment

Any keywords, like PRE or DOM, must be in uppercase.  Additional LMHOSTS keywords can be found in MSKB Q102725.

LMHOSTS files can also leverage information stored in the 16th byte of a NetBIOS name, this can include indicators for domain controllers and master browsers.  Because this information is stored specifically in the 16th byte of the name, proper formatting of such entries is important.  The computer name must be put into quotes that contain the 16th byte information starting in the correct location.  The most commonly used 16th byte entry is "\0x1b", used to indicate a domain master browser.  A full set of entries for a domain would include one domain master browser entry under the domain's name, and one entry for each domain controller using the #DOM keyword.  For example, here are the entries for a domain called "frogs" with domain controllers "PDC" and "BDC" with IP addresses of 192.168.1.12 and 192.168.1.35 respectively:

192.168.1.12  "FROGS  \0x1b"  #PRE #DOM:FROGS

192.168.1.12  PDC      #PRE   #DOM:FROGS

192.168.1.35  BDC      #PRE   #DOM:FROGS

Note that the entire entry between the quotes on each of the first three lines should be exactly 20 characters long.  The domain name given with a "\0x1b" entry must be in uppercase to function properly (see MSKB Q262655). 

LMHOSTS files can also be imported into a WINS server as a set of static entries, but this generally requires extensive use of 16th byte character information.  A full list of the special characters is available in MSKB article Q163409. 

An LMHOSTS file for a non-Windows 2000 workstation needing to authenticate against the campus Active Directory would include the following lines:

128.138.129.118   "AD  \0x1b" #PRE    #DOM:AD

128.138.129.118   DC11    #PRE    #DOM:AD

128.138.238.8     DC12    #PRE    #DOM:AD

128.138.149.42    DC13    #PRE    #DOM:AD

If you wish to import the NetBIOS data for the campus Active Directory into a local WINS server, import an LMHOSTS file containing the following lines:

128.138.129.118 "AD   \0x1b"   #PRE    #DOM:AD

128.138.129.118 "DC11  \0x1c"  #PRE    #DOM:AD

128.138.238.8   "DC12  \0x1c"  #PRE    #DOM:AD

128.138.149.42  "DC13  \0x1c"  #PRE    #DOM:AD

For more information on the use of LMHOSTS files for NetBIOS resolution, see these MSKB articles:

  • The Lmhosts File for TCP/IP in Windows (101927)
  • How to Write an LMHOSTS File for Domain Validation and Other Name Resolution Issues (180094)
  • Troubleshooting LMHOSTS Name Resolution Issues (180099)
  • Domain Browsing with TCP/IP and LMHOSTS Files (150800)
  • LMHOSTS File Information and Predefined Keywords (102725)
  • * NetBIOS Suffixes (16th Character of the NetBIOS Name) (163409)
  • Primary Domain Controller (PDC) Names Entered in LMHOSTS File Are Case-Sensitive (262655)


       
       Support | Training | Facilities | About ITS | ITS Home
 

Last reviewed: May 09, 2005

itsfeedback@colorado.edu  | Policies | Privacy
© 2000
The Regents of the University of Colorado