How to write an Lmhosts file for domain validation and other name resolution issues (180094)



The information in this article applies to:

  • Microsoft Windows NT Server 4.0 Terminal Server Edition
  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional
  • Microsoft Windows NT Workstation 3.5
  • Microsoft Windows NT Workstation 3.51
  • Microsoft Windows NT Workstation 4.0
  • Microsoft Windows NT Server 3.5
  • Microsoft Windows NT Server 3.51
  • Microsoft Windows NT Server 4.0
  • Microsoft Windows 98
  • Microsoft Windows 95

This article was previously published under Q180094
For a Microsoft Windows XP version of this article, see 314108.

SUMMARY

If you experience name resolution issues on your TCP/IP network, you may have to use Lmhosts files to resolve NetBIOS names. This article discusses the correct method to create an Lmhosts file to help in name resolution and domain validation.

MORE INFORMATION

To create a correctly formatted Lmhosts file, follow these steps:
  1. Use any text editor, such as Notepad.exe or Edit.com, to create a file named Lmhosts, and save it in the following folder:
          Microsoft Windows NT
          ----------
    
          %SystemRoot%\System32\Drivers\Etc
    
          Microsoft Windows 95
          ----------
    
          C:\Windows (the folder where Windows is installed)
    
          Microsoft Windows NT and Windows 2000
          ---------------------------
    
          %SystemRoot%\System32\Drivers\Etc
    						
    Note The file name is Lmhosts, without an extension. If you use Notepad.exe, it may automatically append the .txt extension. In this case, at a command prompt, you must rename the file using no extension.
  2. Add the following entries to the Lmhosts file:
          10.0.0.1   PDCNAME   #PRE #DOM:DOMAIN-NAME
          10.0.0.1   "DOMAIN-NAME    \0x1b"   #PRE
    					
    Note The domain name in this entry is case sensitive. Make sure that you use uppercase characters for the domain name. If you use lowercase characters for the domain name, NetBT does not recognize the name.
Note Make sure that you space these entries correctly. Replace 10.0.0.1 with the IP address of your primary domain controller (PDC). Replace PDCName with the NetBIOS name of your PDC, and replace 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 sixteenth character is, copy the following line to your Lmhosts file:
      # IP Address    "123456789012345*7890"
				
Line up the double quotation marks (") by adding or removing spaces from the comment line, and put the \ on the sixteenth column (the column marked with the asterisk). You must use spaces after the name and before the \, not a tab.

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

163409 NetBIOS Suffixes (16th Character of the NetBIOS Name)

  1. After you add the lines, save the file, and exit the editor.
  2. At a command prompt, type nbtstat -R, and then press ENTER.

    Note The -R is case sensitive and must be uppercase. After you type this text, you should receive the following message: Successful purge and preload of the NBT Remote Cache Name Table.
  3. At a command prompt, type nbtstat -c, and then press ENTER.

    Note The -c is case sensitive and must be lowercase. After you type this text, you should receive a display that is 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 additional information, click the following article number to view the article in the Microsoft Knowledge Base:

180099 Troubleshooting LMHOSTS Name Resolution Issues


Modification Type:MajorLast Reviewed:2/15/2005
Keywords:kbhowto KB180094