2.2.3 LMHOSTS File Syntax

The LMHOSTS file is a static text file of NetBIOS name and IPv4 addresses along with additional directives for processing, including a "#include <filename>" mechanism.

  • There can be one entry per line. An entry consists of an IPv4 address and a name, which can be either a computer name or a NetBIOS service name.

  • Comment lines in the LMHOSTS file start with "#".

  • Comments can start after the start of a line, with "#", and without the use of LMHOSTS keywords. (See the LMHOSTS keywords in the table that follows.)

  • The "#" can also denote LMHOSTS keywords listed in the table that follows.

  • ComputerName Entries consist of an IPv4 address and a NetBIOS computer name where the name is 1 to 15 characters in length. A computer name can be used to either: 1) resolve a name to an IP address, or 2) resolve a NetBIOS service name to an address. Example: "     emailsrv1".

  • ServiceName entries consist of an IPv4 address and a NetBIOS service name that specifies a 16-byte name where the last byte indicates the type of the service and bytes 1 to 15 specify ComputerName, padded at the end with blanks to the 15th byte:

    •     "ComputerName   \0x03" where the last byte is specified in hex.

  • Entry Names are not case-sensitive.

  • The LMHOSTS file has an implementation-specific file location.<4>