Sample Lmhosts File

Though similar to the HOSTS file and located in the same directory, the LMHOSTS file maps NetBIOS names to IP addresses whereas the HOSTS file maps hierarchal FQDN to IP addresses. Though both can be used to help each other out in the name resolution process, be sure you know the difference.

Table 4.2 LMHOSTS File Keywords Keyword Tag Function/Description

#PRE Used to preload name entries into a machine's remote name cache. It will remain in cache until removed from the LMHOSTS file and reloaded.

#DOM: <domain> Used to identify a domain controller for a particular domain.


Table 4.2 LMHOSTS File Keywords Keyword Tag Function/Description

#INCLUDE <path to file> Used to point a client to use another centrally located

LMHOSTS file using a UNC file path. In order to use this tag, statically set the server and IP address in your original LMHOSTS file that is used in the <path to file> location.

#BEGIN_ALTERNATE Used along with the #INCLUDE statement to list alternative servers hosting centralized LMHOSTS files. Alternative LMHOSTS file locations are attempted only if the previous locations were unaccessible.

Used to end the #BEGIN_ALTERNATIVE tag and is used after the last #INCLUDE tag.

Used to identify multihomed computer systems.

Used to avoid NetBIOS-directed name queries for LAN Manager UNIX systems.

Used to define a special (Internet) group specified by a name. These tags along with special groups in general are limited to 25 members.

\0xnn Used to identify machines with a specific service or application. Use the hexadecimal number of the service or application as the sixteenth character in the NetBIOS name and enclose the entire name in quotation marks.



Figure 4.6 Sample LMHOSTS File

Figure 4.6 Sample LMHOSTS File

Lmhosts File

If using an LMHOSTS file, it is a good idea to add a comment to the top of the file that states who last edited the file, the date, and what was changed. This helps clear some of the confusion when problems arise due to LMHOSTS file changes.

Notice that in Figure 4.6 we used one of the hexadecimal tag options described in Table 4.2.These tags are used to clearly identify a particular NetBIOS service registered on your network. Specifically we used the /0x1b tag, which identifies a Domain Master Browser, or more specifically, a Primary Domain Controller/PDC Emulator. This is useful for down-level domain trusts or down-level domain authentication.Table 4.3 shows you more of the common hexadecimal switches you can take advantage of in your LMHOSTS file.

Table 4.3 Service Specific HEX Locators

HEX Suffix Number (LMHOSTS Tag)

Network Service

The Ultimate Computer Repair Guide

The Ultimate Computer Repair Guide

Read how to maintain and repair any desktop and laptop computer. This Ebook has articles with photos and videos that show detailed step by step pc repair and maintenance procedures. There are many links to online videos that explain how you can build, maintain, speed up, clean, and repair your computer yourself. Put the money that you were going to pay the PC Tech in your own pocket.

Get My Free Ebook


  • dehab
    How to clear lmhosts name cache?
    6 years ago
  • alaric
    How to create lmhost file for fqdn?
    6 years ago
  • Kedija
    Does dns server use local lmhost file?
    2 years ago

Post a comment