LMHOSTS

The LMHOSTS file looks exactly like a hosts file and functions in a similar way. The difference is that the LMHOSTS file maps NetBIOS names to IP addresses, and the hosts file maps TCP/IP host names to IP addresses. A sample LMHOSTS file shows how similar these two files look:

172.16.6.16 	anubis
172.16.6.10 	thor
172.16.6.7 	theodore

Each entry in an LMHOSTS file contains an IP address that is separated by whitespace from the NetBIOS name associated with that address. An entry must not exceed a single line and comments begin with the pound sign (#). The LMHOSTS file is stored in the %SystemRoot%\system32\drivers\etc directory.

The LMHOSTS file does have some features that are not supported by the host file. These special commands begin with pound signs (#) so that older Microsoft operating systems will treat them as comments, allowing the same file to be used on both NT systems and older operating systems. The NT commands are:

#PRE

Causes the entry to be pre-loaded into the cache and permanently retained there. Normally entries are only cached when they are used for name resolution and are only retained in the cache for a few minutes. Use #PRE to speed up address resolution for frequently used host names.

#DOM:domain

Identifies NT domain controllers. The domain variable is the name of the NT domain for which this system is a controller. Every domain controller in the LMHOSTS file should be identified by a #DOM command. If you don’t use NT domains, this command is not needed.

#INCLUDE ...

Get Windows NT TCP/IP Network Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.