How to Write an LMHOSTS File for Domain Validation and Other Name Resolution Issues

ID: Q180094


The information in this article applies to:
  • Microsoft Windows NT Workstation versions 3.5, 3.51, 4.0
  • Microsoft Windows NT Server versions 3.5, 3.51, 4.0
  • Microsoft Windows 95


SUMMARY

There may be instances when you are experiencing name resolution issues on your TCP/IP network and you need to use Lmhosts files to resolve NetBIOS names. This article discusses the proper method of creating an Lmhosts file to aid in name resolution and domain validation.


MORE INFORMATION

Use the following steps to create a properly formatted Lmhosts file:

  1. Using a text editor, such as Notepad.exe or Edit.com, create a file called Lmhosts and save it in the following folder:
    
          Windows NT
          ----------
    
          %SystemRoot%\System32\Drivers\Etc
    
          Windows 95
          ----------
    
          C:\Windows (the folder where Windows is installed) 
    NOTE: The file name is Lmhosts, with no extension. If you are using Notepad.exe it may append .txt automatically. If it does this, you will need to rename the file using no extension at a command prompt.


  2. Add the following entries to the Lmhosts file:
    
          10.0.0.1   PDCName   #PRE #DOM:Domain
          10.0.0.1   "Domain         \0x1b"   #PRE 


NOTE: Spacing of these entries is imperative. Replace 10.0.0.1 with the IP address of your primary domain controller (PDC), PDCName with the NetBIOS name of your PDC, and Domain with your Windows NT domain name. There must be a total of 20 characters within the quotations (the domain name plus the appropriate number of spaces to pad up to 15 characters plus the backslash plus the NetBIOS hex representation of the service type).

To help determine where the 16th character is, copy the following line to your LMHOSTS file:

      # IP Address    "123456789012345*7890" 
Line up the double quotes (") by adding or removing spaces from the comment line, and place the \ on the 16th column (the column marked with the asterisk). You must use SPACES after the name and before the \, not a tab.

For more information, see the following article in the Microsoft Knowledge base:
Q163409 NetBIOS Suffixes (16th Character of the NetBIOS Name)
  1. After you add the above lines, save the file, and exit the editor.


  2. From a command prompt, type the following and press ENTER:
    nbtstat -R
    NOTE: The -R is case sensitive and must be upper case. After typing the above, you should receive the following message:
    Successful purge and preload of the NBT Remote Cache Name Table.


  3. Type the following at a command prompt and then press ENTER:
    nbtstat -c
    NOTE: The -c is also case sensitive and must be lower case. After typing the above, you should receive a display similar to the following:
    
          Node IpAddress: [10.0.0.5] Scope Id: []
    
                       NetBIOS Remote Cache Name Table
    
             Name              Type       Host Address    Life [sec]
          ----------------------------------------------------------
          PDCName        <03>  UNIQUE      10.0.0.1           -1
          PDCName        <00>  UNIQUE      10.0.0.1           -1
          PDCName        <20>  UNIQUE      10.0.0.1           -1
          Domain         <1B>  UNIQUE      10.0.0.1           -1 


For more information, see the following article in the Microsoft Knowledge base:
Q180099 Troubleshooting LMHOSTS Name Resolution Issues

Additional query words:

Keywords : NTSrvWkst
Version : WINDOWS:95; winnt:3.5,3.51,4.0
Platform : WINDOWS winnt
Issue type : kbhowto


Last Reviewed: September 23, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.