LMHOSTS is the file name for the Microsoft Windows LAN Manager Hosts file. This file matches IP addresses with computer and node names, and can be used as a backup when the Windows Internet Naming Service (WINS) is not working. Coupled with the HOSTS file, which matches names to IPs, you can set static information that will work when other mapping services are offline. Some examples include mapping your printer or print server, a Domain Name Service (DNS) server, or a gateway to a static IP.
The file can be found on most recent Windows systems by opening a Windows Explorer window (such as opening your My Documents folder), and pasting the following into the address bar: %windir%\system32\drivers\etc\ Note that the %windir% is a local environmental variable that will resolve to where your Windows directory is located. The LMHOSTS file is set as a hidden system file, so you need to set your Windows Explorer view such that you can see the files. The file can be edited by using Notepad (or any other text editor, but NOT WORD or WORDPAD, unless you specifically set the file to plain text. The LMHOSTS file does not have an extension, such as .txt, but there is usually a template file called LMHOSTS.sam available in the same folder. Note that not all newer Microsoft systems have the LMHOSTS file. If you'd like one, you can add it to the directory, and on the next reboot, Windows will recognize and import the data.
The typical information most folks would want is:
10.0.0.1 PDCNAME #PRE #DOM:DOMAIN_NAME
10.0.0.1 "DOMAIN_NAME \0x1b" #PRE
This notes the IP address of your domain controller
. Replace the 10.0.0.1 with the actual IP address of your DC, and replace PDCNAME with the NetBIOS name of your DC. Note that NetBIOS
names are always 15 characters or less, and do not include the domain name. For the second line, replace the IP as you did with line one, and replace DOMAIN_NAME with your domain name, making sure to use ALL CAPS. The tough part is that the backslash character must be the 16th character, so pad out the space between the domain name and the backslash as needed.
192.168.2.2 CHEESYDC #PRE #DOM:DOMAIN_NAME
192.168.2.2 "RANCIDPICKLE \0x1b" #PRE
This would identify my domain controller, CHEESYDC, on my domain RANCIDPICKLE, with the spaces needed to put the backslash at the 16 character spot.