LMHOSTS file definition
The LMHOSTS (LAN Manager Hosts) file is a Windows system file used for network node identification and name resolution. Its primary purpose is to map NetBIOS names (the names of devices on a network) to their corresponding IP addresses. This is especially useful in small network environments where a DNS server is not present or as a supplement to DNS in larger networks.
See also: hosts file, NetBIOS
Characteristics of the LMHOSTS file
LMHOSTS is a plaintext file that can be edited with standard text editors, like Notepad in Windows.
Each entry consists of an IP address and the corresponding NetBIOS name of a computer or network device. Entries are usually written in a single line with the IP address first, followed by the NetBIOS name. Comments for documentation and readability can be added with the # symbol.
The LMHOSTS file is typically located in the directory C:\Windows\System32\drivers\etc\ in Windows operating systems.
Use cases of the LMHOSTS file
- Host name resolution. LMHOSTS is used to map IP addresses to host names on a local network. This is particularly useful in small networks without a Domain Name System (DNS) server.
- NetBIOS name resolution. It helps in resolving NetBIOS names, which are the names given to devices on a network, to their corresponding IP addresses.
- Backup for DNS. It can be used as a backup in case the DNS service fails or is unavailable.
- Network troubleshooting. Administrators may use it for diagnostics, especially for issues related to network names.
Advantages of the LMHOSTS file
- Simplicity and control. The LMHOSTS file is simple to edit and manage, giving direct control over name resolution entries.
- No dependency on network services. It does not rely on network services like DNS or WINS, making it useful when these are down.
- Useful for small networks.The LMHOSTS file provides name resolution without the need for more complex infrastructure.
Disadvantages of the LMHOSTS file
- Manual updates required. Any change in the network, such as a device getting a new IP address, requires a manual update of the LMHOSTS file. This can be time-consuming and error-prone.
- Scalability issues. The LMHOSTS file is hard to manage in large setups due to its manual nature.
- Lack of dynamic resolution. Unlike DNS, the LMHOSTS file does not update names automatically. That makes it less efficient in environments where network devices change frequently.
- Potential security risks. Incorrect entries in the LMHOSTS file can create security problems, such as sending traffic to unintended hosts.
- Limited functionality. The LMHOSTS file only resolves NetBIOS names to IP addresses. DNS provides more services, like resolving domain names to IP addresses and load balancing.
- Local access only. Each computer has its own LMHOSTS file, so changes must be made on all devices on the network.