Maintaining the LMHOSTS File

When you use an LMHOSTS file, be sure to keep it up-to-date and organized. Use the following guidelines:

  • Update the LMHOSTS file whenever the NetBIOS name of a computer on the network is changed or removed.

  • Because LMHOSTS files are searched one line at a time from the beginning, list remote computers in priority order, with those used most often at the top of the file, followed by remote systems listed in #INCLUDE statements.

  • Use #PRE entries to preload into the local computer's name cache frequently accessed workstations and servers listed in the #INCLUDE statements. #PRE keyword entries should be entered at the end of the file, because these are preloaded into the cache at system startup time and are not accessed later. This increases the speed of searches for the entries used most often, because any comment text that you add increases the time required to parse the file.

  • Use the nbtstat command to remove or correct preloaded entries that might have been typed incorrectly or any names cached by successful broadcast resolution. You can refresh the name cache by running nbtstat -R , which purges and reloads the name cache, rereads the LMHOSTS file, and then inserts entries tagged with the #PRE keyword. For more information about nbtstat , see Windows 2000 Server Help.