A local hosts file used by Microsoft Wins Clients such as Microsoft Windows 98 or Windows NT to provide mappings of IP addresses to NT computer names (NetBIOS name). The lmhosts file is located in either the root Windows directory, the Windows\System32\drivers\etc directory, or Winnt\System32\drivers\etc depending on the version of Windows and is called “lmhost.sam“. The lmhosts file will likely already contain data in the file, such as commented instructions and examples similar to the below example.
127.0.0.1 localhost #example of the local host
18.104.22.168 example #example of a fake IP and name.
In the above two examples, you can see that we have specified the IP address, the name, and the # remark for that line. In the above example, “localhost” or “example” would be the NetBIOS name; therefore, when typing “localhost” or “example” in Internet Explorer, for example, the computer would attempt to resolve that name by accessing the IP address corresponding with that name.
This file is also commonly modified when unable to access or having difficulties with the DNS server, to help prevent access to a specific domain, and/or redirect the computer to a different location.
How do you edit this file?
- Locate and open the file. Because this file can be in different locations its usually easiest to simply open the Windows search and search for “lmhosts.sam” file. Additional information about finding files in Microsoft Windows can be found on document CHFIND.For users who are manually looking to locate the file below is a listing of the version of Windows and the location of the lmhosts file.
Microsoft Windows 98
Microsoft Windows 2000
Microsoft Windows XP
- Once the file has been located right-click the file and select “Open With…” and if prompted select “Select the program from a list” and click Ok.
- In the listing of programs used to open the file scroll to the bottom of the list and highlight WordPad and click the Ok button.
Following the above steps should open the lmhosts.sam file in WordPad and allow you to add or remove content from the file.