The lmhosts is a local hosts file used by Microsoft Wins Clients such as Microsoft Windows 98, Windows NT, Windows XP, and later versions of Windows to provide mappings of IP addresses to NT computer names (NetBIOS names). This file is also modified when unable to access or encountering difficulties with the DNS server, to help prevent access to a specific domain, or redirect the computer to a different location.
How do I locate and edit this file?
- Locate and open the file. Because this file can be in different locations, it's usually easiest to open the Windows search and search for "lmhosts.sam" file.
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 XP, Vista, 7, and 8
Microsoft Windows 2000
Microsoft Windows 98 and ME
- 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 or your preferred text editor 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.
What's in the lmhost file and what can I add?
By default, the lmhosts file will already contain data in the file, such as commented instructions and examples similar to the example below.
127.0.0.1 localhost #example of the local host
220.127.116.11 example #example of a fake IP and name.
In the above two lines, there is an IP address, the NetBIOS name, and the # remark for that line. In the above example, "localhost" and "example" would be the NetBIOS name which means when typing "example" in Internet Explorer, for example, the computer would attempt to resolve that name by accessing the IP address 18.104.22.168 corresponding with that name.
Access denied when trying to save changes
If you're running Windows Vista, Windows 7, or Windows 8 you may get an "access denied" error when attempting to save changes to the lmhost file. This error is caused when your editor does not have administrator rights. To resolve this issue run Notepad, WordPad, or your editor of choice as administrator.