Microsoft KB Archive/314108

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

Article ID: 314108

Article Last Modified on 9/18/2006

-

APPLIES TO


 * Microsoft Windows XP Professional

-



This article was previously published under Q314108



For a Microsoft Windows 2000 version of this article, see 180094.



SUMMARY
There may be instances when you experience name resolution issues on your TCP/IP-based network and you need to use an LMHOSTS file to resolve NetBIOS names. This article describes how to create an LMHOSTS file to aid in name resolution and domain validation.



MORE INFORMATION
Use the following steps to create a correctly formatted LMHOSTS file:  Using a text editor, for example, Notepad.exe or Edit.com, create a file called LMHOSTS, and then save it in the following folder:

%SystemRoot%\System32\Drivers\Etc

Note that the file name is LMHOSTS, with no extension. If you are using Notepad.exe, Notepad.exe may automatically append .txt. If Notepad.exe does this, rename the file, using no extension, at a command prompt.

  Add the following entries to the LMHOSTS file:   10.0.0.1   PDCNAME #PRE #DOM:DOMAIN_NAME 10.0.0.1  &quot;DOMAIN_NAME    \0x1b&quot;   #PRE Note also that DOMAIN_NAME in this entry is case-sensitive. Make sure to use all capital letters. 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_NAME with the name of your Windows NT-based domain.

The correct spacing of these entries is imperative. In the line that has quotation marks (&quot;), there must be a total of exactly 20 characters between the quotation marks. To get this total of 20 characters, type the domain name, add enough spaces to pad the domain name to 15 characters, and then add the backslash and the NetBIOS hex number that represents the service type.

The backslash should be the sixteenth character. To help you know exactly where the sixteenth character is, copy the following line to your LMHOSTS file:   # IP Address    &quot;123456789012345*7890&quot; Line up the quotation marks in your comment line with the quotation marks in the copied line, by adding or removing spaces from your comment line to place the \ on the sixteenth column (the column that is marked with the asterisk). Note that you must use spaces, not a tab character, after the domain name and before the \.

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

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

 After you add the lines, save the file, and then quit the text editor. At a command prompt, type the following, and then press ENTER:

nbtstat -R

Note that the -R is case-sensitive and must be capitalized. After you enter the command, you should receive the following message:

Successful purge and preload of the NBT Remote Cache Name Table.

  At a command prompt, type the following, and then press ENTER:

nbtstat -c

Note that the -c is also case-sensitive and must be lowercase. After you enter the command, you should receive a display similar to the following table. <pre class="fixed_text">  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 article number below to view the article in the Microsoft Knowledge Base:

180099 Troubleshooting LMHOSTS Name Resolution Issues

</li></ol>

Keywords: kbinfo KB314108

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.