Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LMHOSTS or HOSTS files. Whats the difference?

Networking

LMHOSTS or HOSTS files. Whats the difference?

by  butchrecon  Posted    (Edited  )
Hosts file or LMHosts file, whatÆs the difference? Here is an article that might clear things up (as mud anyway).

Name Resolution for Windows Networking
For TCP/IP and the Internet, the globally known system name is the computer's host name, appended with a DNS domain name (for example, rhit.microsoft.com). This defaults to the computer name (NetBIOS name) defined during Windows 95 Setup. The default name can be changed in the DNS dialog box when you are configuring TCP/IP properties.
Computers use IP addresses to identify each other, but users usually find it easier to work with computer names. A mechanism must be available on a TCP/IP network to resolve names to IP addresses. To ensure that both the name and the address are unique, the computer using Microsoft TCP/IP registers its name and IP address on the network during system startup. Computers running Microsoft TCP/IP on the network can use one or more methods for name resolution in TCP/IP internetworks, as summarized in this section.
Broadcast name resolution.
Computers running Microsoft TCP/IP can use broadcast name resolution, which is a NetBIOS-over-TCP/IP mode of operation defined in RFC 1001/1002 as b-node. This method relies on a computer making IP-level broadcasts to register its name by announcing it on the network. Each computer in the broadcast area is responsible for challenging attempts to register a duplicate name and for responding to name queries for its registered name.
LMHOSTS or HOSTS files.

An LMHOSTS file specifies the NetBIOS computer name and IP address mappings; a HOSTS file specifies the DNS name and IP address. On a local computer, the HOSTS file (used by Windows Sockets applications to find TCP/IP host names) and LMHOSTS file (used by NetBIOS over TCP/IP to find NetBIOS computer names) can be used to list known IP addresses mapped with corresponding computer names. LMHOSTS is used for name resolution in Windows 95 for internetworks where WINS is not available.
+ The HOSTS file is used as a local DNS equivalent to resolve host names to IP addresses.
+ The LMHOSTS file is used as a local WINS equivalent to resolve NetBIOS computer names to IP addresses.
Each of these files is also known as a host table. Sample versions of LMHOSTS (called LMHOSTS.SAM) and HOSTS files are added to the Windows directory when you install Windows 95 with TCP/IP support. These files can be edited using any ASCII editor, such as WordPad or Edit. To take advantage of HOSTS or LMHOSTS, DNS must be enabled on the computer. For information about setting up and using HOSTS and LMHOSTS files, see Appendix G, "HOSTS and LMHOSTS Files for Windows 95."

Windows Internet Name Service.
Computers running Microsoft TCP/IP can use WINS if one or more Windows NT Server computers configured as WINS servers are available, containing a dynamic database for mapping computer names to IP addresses. WINS can be used in conjunction with broadcast name resolution for an internetwork, where other name resolution methods are inadequate. WINS is a NetBIOS-over-TCP/IP mode of operation defined in RFC 1001/1002 as h-node or m-node; WINS clients default to h-node. Notice that WINS is a dynamic replacement for the LMHOSTS file. For more information, see "Using WINS for Name Resolution" later in this chapter.
Domain Name System name resolution.

DNS provides a way to look up name mappings when connecting a computer to foreign hosts using NetBIOS over TCP/IP or Windows Sockets applications such as FTP. DNS is a distributed database designed to relieve the traffic problems that arose with the first growth explosion on the Internet in the early 1980s. A DNS name server must be configured and available on the network. Notice that DNS replaces the functionality of the HOSTS file by providing a dynamic mapping of IP addresses to host names used by TCP/IP applications and utilities. For more information, see "Using DNS for Name Resolution" later in this chapter.
Windows 95 provides support for multiple DNS servers and up to two WINS servers. Support for either service can be configured automatically from a DHCP server, manually in Windows 95 Setup, or after Setup by using the Network option in Control Panel.


Name Resolution with Host Files
For computers located on remote subnets where WINS is not used, the HOSTS and LMHOSTS files provide mappings for names to IP addresses. This name-resolution method was used on internetworks before DNS and WINS were developed. The HOSTS file can be used as a local DNS equivalent; the LMHOSTS file can be used as a local WINS equivalent.
Note
Sample versions of LMHOSTS and HOSTS files are added to the Windows NT \systemroot\System32\drivers\Etc directory when you install Microsoft TCP/IP.

HOSTS
Microsoft TCP/IP can be configured to search HOSTS (the local host table file) for mappings of remote host names to IP addresses. The HOSTS file format is the same as the format for host tables in the 4.3 Berkeley Software Distribution (BSD) UNIX /etc/hosts file. For example, the entry for a computer with an address of 192.102.73.6 and a host name of mfg1.widgets.com looks like this:

192.102.73.6 mfg1.widgets.com

You can create the file by using a text editor ù for example, Notepad ù to create, and change the HOSTS file because it is a simple text file. (An example of the HOSTS format is provided in the file named HOSTS.sam in the Windows NT %systemroot%\System32\Drivers\Etc directory. This is only an example file; do not use this file as the primary HOSTS file.)Edit the sample HOSTS file (created when you install TCP/IP) to include remote host names and IP addresses for each computer with which you will communicate.

LMHOSTS
The LMHOSTS file is a local text file that maps IP addresses to NetBIOS computer names. It contains entries for Windows-networking computers located outside the local subnet. The LMHOSTS file is read when WINS or broadcast name resolution fails; resolved entries are stored in a local cache for later access.
For example, the LMHOSTS table file entry for a computer with an address of 192.45.36.5 and a computer name of mrp2 looks like this:

192.45.36.5 mrp2

You can create the file by using a text editor ù for example, Notepad ù to create, and change the LMHOSTS file because it is a simple text file. (An example of the LMHOSTS format is provided in the file named LMHOSTS.sam in the Windows NT %systemroot%\System32\Drivers\Etc directory. This is only an example file; do not use this file as the primary LMHOSTS file.)Edit the sample LMHOSTS file (created when you install TCP/IP) to include remote NetBIOS names and IP addresses for each computer with which you will communicate.
The LMHOSTS file is typically used for small-scale networks that do not have servers. For more information about the LMHOSTS file, see "Using LMHOSTS Files" chapter in this book.

I hope this can clear things up a bit. Many people get this messed up when it comes to WINDOWS TCP/IP Networking.

As always if you think there should be more added or changed let me know. :)
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top