How to Write an LMHOSTS File for Domain Validation and Other Name Resolution Issues
This article was previously published under Q314108
This article has been archived. It is offered "as is" and will no longer be updated.
For a Microsoft Windows 2000 version of this article, see 180094.
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.
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\EtcNote 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 "DOMAIN_NAME \0x1b" #PRENote 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 ("), 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 "123456789012345*7890"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 -RNote 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 -cNote 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.
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 -1For additional information, click the article number below to view the article in the Microsoft Knowledge Base:180099 Troubleshooting LMHOSTS Name Resolution Issues
Article ID: 314108 - Last Review: 12/07/2015 08:19:51 - Revision: 2.2
Microsoft Windows XP Professional
- kbnosurvey kbarchive kbinfo KB314108