Lmhosts

Updated: 11/13/2018 by Computer Hope

The lmhosts is a local hosts file used by Microsoft Wins Clients that provides mappings of IP addresses to NT computer names (NetBIOS names). Lmhosts may be modified to help resolve issues with access to a DNS (domain name system) server, prevent access to a specific domain, or redirect the computer to a different location.

How do I locate and edit this file?

  1. 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.

To manually locate the lmhosts file, use the location in the following list that corresponds with your version of Windows.

Microsoft Windows XP, Vista, 7, and 8
C:\Windows\System32\drivers\etc

Microsoft Windows 2000
C:\Winnt\System32\drivers\etc

Microsoft Windows 98 and Windows Me
C:\Windows\

  1. Once the file is located, right-click the file and select "Open With..." and if prompted select "Select the program from a list" and click OK. In the list of programs used to open the file, scroll to the bottom and highlight WordPad or your preferred text editor and click the OK button.

Following the steps above 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 already contains 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
4.7.5.3 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" are the NetBIOS names. When typing "example" in Internet Explorer, the computer would attempt to resolve that name by accessing the IP address 4.7.5.3.

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.

Hosts file, Localhost, Network terms