Platinum Edition Using Windows NT Server 4

Previous chapterNext chapterContents


Chapter 12

Configuring TCP/IP

Some of the main topics in this chapter are

TCP/IP, which stands for Transmission Control Protocol/Internet Protocol, is a network transport protocol widely supported by a majority of operating systems, including all versions of UNIX, Windows NT, Windows 95, Windows 3.x, Novell NetWare, Macintosh, OpenVMS, and others. TCP/IP offers a number of advantages that make it an excellent network transport protocol, particularly for connecting dissimilar computers and for enabling wide-area networking.

You can use TCP/IP as your only network protocol or in conjunction with another protocol. You might use NetBEUI within your LAN, for example, and use TCP/IP to connect to the Internet through a router or dial-up connection. Or, you might decide to use TCP/IP as your LAN protocol, as well. TCP/IP is versatile but also complex. Before you can set up a TCP/IP network and correctly configure the computers and other devices on the network, you must understand many key issues. The following sections explain these issues, beginning with IP addressing.

Understanding IP Addressing

On a TCP/IP network, a host is any device on the network that uses TCP/IP to communicate, including computers, routers, and other devices. Each host must have a unique address, called an IP address (IP stands for Internet Protocol). An IP address identifies the host on the network so that IP data packets can be properly routed to the host. IP data packets are simply data encapsulated in IP format for transmission by using TCP/IP. Every IP address on the network must be unique; conflicting (identical) IP addresses on two or more computers prevents those computers from correctly accessing and using the network.

An IP address is a 32-bit value usually represented in dotted-decimal notation, in which four octets (eight bits each) are separated by decimals, as in 198.87.118.1. The IP address actually contains two items of information: the address of the network and the address of the host on the network. How the network and address are defined within the address depends on the class of the IP address.

IP addresses are grouped into three classes: A, B, and C. These classes are designed to accommodate networks of varying sizes. Table 12.1 describes the IP address classes, where the variables w.x.y.z designate the octets in the address structure.

Table 12.1 IP Address Classes

Class Range Network ID Host ID Available Networks Available Hosts
A 1-126 w x.y.z 126 16,777,214
B 128-191 w.x y.z 16,384 65,534
C 192-223 w.x.y z 2,097,151 254


TIP: The address 127 is reserved on the local computer for loopback testing and interprocess communication, and therefore is not a valid network address. Addresses 224 and higher are reserved for special protocols and can't be used as host addresses. Host addresses 0 and 255 are used as broadcast addresses and should not be assigned to computers.

As Table 12.1 shows, class A networks are potentially quite large, encompassing as many as 16,777,214 hosts. If you've set up your own TCP/IP network, yours most likely falls into the class C network category, which is limited to 254 hosts.

You might wonder what's so important about an IP address. Routing data packets between computers is impossible without an IP address. By referencing the network portion of your IP address, a sending computer can route packets (with the help of intermediate routers and networks) to your network. The host portion of your IP address then routes the packet to your computer when the packet finally reaches the network.

Using Subnet Masks

A subnet mask is a 32-bit value expressed as a series of four octets separated by periods, just like an IP address. The subnet mask enables the recipient of an IP data packet to strip (mask) the IP address to which the IP packet is being sent into network ID and host ID. Basically, the subnet mask enables the IP address to be broken into its two component parts. Table 12.2 shows the default subnet masks for standard class A, B, and C networks, with each subnet mask shown in binary and dotted-decimal forms.

Table 12.2 Default Subnet Masks

Class Bit Value Subnet Mask
A 11111111 00000000 00000000 00000000 255.0.0.0
B 11111111 11111111 00000000 00000000 255.255.0.0
C 11111111 11111111 11111111 00000000 255.255.255.0
In addition to enabling an IP address to be resolved into its network and host components, subnet masks also serve to segment a single network ID into mulTiple local networks. Assume that your large company has been assigned a class B IP network address of 191.100. The corporate network comprises 10 different local networks with 200 hosts on each. By applying a subnet mask of 255.255.0.0, the network is divided into 254 separate subnetworks, 191.100.1 through 191.100.254. Each of the 254 subnetworks can contain 254 hosts.


TIP: The subnet masks described in Table 12.2 are not the only masks you can use. Sometimes you have to mask only some of the bits in an octet. The network address and subnet mask must match, however, for every host on a local network.

Acquiring an IP Address

Although theoretically you could arbitrarily assign your own IP network address for your network, any address you might choose probably would already be assigned to someone else's network. If your network is self-contained and not connected to the Internet, duplicate addressing shouldn't cause any problems. If your network is connected to the Internet or you decide to connect it in the future, however, duplicate addressing causes serious routing problems for both networks.


NOTE: There is no charge to register an IP address. InterNIC does, however, charge for network domain name registration. Currently, the cost is $100 for the first two years and $50 annually beginning the third year.

To assure uniqueness of network addresses, a governing organization known as InterNIC (Internet Network Information Center) is responsible for assigning and maintaining IP addresses. If you set up a TCP/IP network, you should contact InterNIC to obtain a unique network IP address for your network. You can contact InterNIC at the following address or phone number. You also can register through the Internet by sending a registration request to hostmaster@internic.net. If you want more information about InterNIC and IP addressing, connect through the Internet to is.internic.net, log on as anonymous, and browse the directory /INFOSOURCE/FAQ for more information. To contact InterNIC through standard mail, phone, or fax, use the following information:

Network Solutions
InterNIC Registration Services
505 Huntmar Park Drive
Herndon, VA 22070
703-742-4777
Fax 703-742-4811

Understanding Gateways and Routing

To interconnect and provide routing of data packets, TCP/IP subnetworks interconnected with one another or connected to the Internet use gateways (routers). A default gateway generally is a computer or router that maintains IP address information of remote networks (networks outside its own network). Default gateways are required only on interconnected networks--stand-alone TCP/IP subnets do not require default gateways.

Before a host transmits an IP packet, IP inserts the originating and destination IP addresses into the packet. It then checks the destination address to determine whether or not the packet is destined for the same local network as the originating host. If the network addresses match (based on the subnet mask), the packet is routed directly to the destination host on the same subnet. If the network addresses don't match, the packet is sent to the subnet's default gateway, which then handles routing of the packet. The default gateway maintains a list of other gateways and network addresses, and routes the packet accordingly. Although the packet might pass through many gateways, it eventually reaches its destination.

If yours is a stand-alone subnet, you don't need a default gateway. Otherwise, you need at least one functioning default gateway to communicate outside of your subnet. If for some reason your default gateway becomes inoperative (a router fails, for example), you can't communicate outside your subnet, but you still can work within your subnet. If you need to ensure a connection, you might want to consider using multiple default gateways.


TIP: You can use the route utility from the command prompt to specify a static route and override the default gateway.

Using Dynamic Address Assignment

In TCP/IP networks that comprise relatively few nodes, or in which the network configuration is static (computers do not access the network remotely and the number of hosts doesn't fluctuate), IP address administration is relatively easy. The network administrator simply assigns specific IP addresses to each host.

On large or dynamic networks, however, administering IP addresses can be difficult and time-consuming. To help overcome this problem, Windows 95 supports Dynamic Host Configuration Protocol, or DHCP, which enables a host to automatically obtain an IP address from a DHCP server when the host logs on to the network. When you move a host from one subnet to another on your network, the host automatically receives a new IP address, and its original IP address is released, making it available for other connecting hosts.

By providing dynamic addressing, DHCP enables you to manage a pool of IP addresses for a group of hosts. Assume that your company has 100 employees who often dial into your subnet from remote locations, but not at the same time. At any one time, 25 to 30 remote users might be connected to the network, but your subnet has only 50 available subnet host addresses. If you assign IP addresses manually, you can accommodate only 50 of the remote users. You can't assign the same IP address to two users, because if they both connect to the network at the same time, routing problems prevent them from using the network.

Through DHCP, you can allocate a pool of 50 IP addresses to be assigned automatically to the dial-in users. When a user dials in and connects, DHCP assigns the host a unique IP address from the pool. As long as no more than 50 users attempt to log on to the network remotely and acquire IP addresses, you can accommodate all 50 with unique addresses. If the number of users who need to connect exceeds the number of available addresses, the only solution is to expand your pool of available addresses or modify the subnet mask to accommodate more than 50 addresses.

DHCP in Windows NT relies on a Windows NT DHCP server that can assign IP addresses to hosts on the local subnet when the hosts start Windows NT, and can assign IP addresses to hosts that connect to the network remotely.

In addition to using DHCP, Windows NT can request an IP address from a PPP (Point-to-Point Protocol) dial-up router. Whether you use DHCP or connect to a PPP dial-up router, you use the same configuration option to configure dynamic address assignment.


See "Implementing DHCP IP Management," p. 215

Understanding Domains and Name Resolution

Computers have no problems using IP addresses to locate other networks and hosts. The average user, however, can have trouble remembering those dotted-decimal addresses. Domain names and computer names make specifying the addresses or other networks or hosts much easier.

A domain name is a unique named formatted much like an IP address, except that the domain name uses words rather than numbers. The domain name identifies your network and is associated with your network's IP address. If your company is Foo Fang Foods, Inc., for example, your departmental subnet might be known as sales.foofang.com. The first portion, sales, identifies your subnet. The second portion, foofang, identifies your corporate network. The last portion, com, specifies the type of organization, and in this example, indicates a commercial network. Table 12.3 lists common network type identifiers.

Table 12.3 Common Network Type Identifiers

Identifier Meaning
com Commercial entity
gov Government entity
net Networking organization
org General organization
edu Education
mil Military


TIP: As with your IP address, your domain must be unique. If you connect your network to other networks or to the Internet, contact the InterNIC to apply for a unique domain name.

A computer name specifies a host on the subnet. Your host computer name is combined with your domain to derive your Internet address. Your host name doesn't have to match your computer's name that identifies it in its workgroup, but it can. By default, Windows NT uses as your host name the NetBIOS computer name you specify during setup, but you can specify a different name when you configure TCP/IP. Whatever name you specify as the computer name in the TCP/IP configuration is registered with the network when Windows NT starts.


NOTE: The computer name you specify for your computer when you install Windows NT is its NetBIOS name. A computer's NetBIOS name bears no relationship to its host name under TCP/IP. The two names can be different or the same.

No direct translation or correlation exists between IP addresses and domain names and host names. Some method, therefore, is required to enable computers to look up the correct IP address when a user specifies a name rather than an IP address. Your Windows NT host can use one of two methods: DNS or WINS.


See "Implementing WINS and DNS Name Resolution," p. 225

Understanding DNS. DNS stands for Domain Name System. DNS is a distributed database system that enables a computer to look up a computer name and resolve the name to an IP address. A DNS name server maintains the database of domain names and their corresponding IP addresses. The DNS name server stores records that describe all hosts in the name server's zone.

If you use DNS for your Windows NT workstation, you specify the IP address of one or more DNS servers in your TCP/IP configuration. When your workstation needs to resolve a name into an IP address, it queries the DNS servers. If the server doesn't have an entry for the specified name, the name server returns a list of other name servers that might contain the entry you need. The workstation then can query these additional name servers to resolve the name.


TIP: You can define multiple DNS servers in your Windows NT TCP/IP configuration.

Besides a DNS server, you can use the Hosts file to resolve host.domain-formatted names to IP addresses. See "Using HOSTS and LMHOSTS Files," later in this chapter.

Understanding WINS. WINS stands for Windows Internet Name Service. WINS provides a dynamic database for managing name resolution. WINS relies on a Windows NT server to act as a WINS server. When you install TCP/IP on your workstation, the client software necessary to connect to a WINS server is installed automatically.

One advantage of using WINS is that it's dynamic, rather than static like DNS. If you use DHCP to assign network addresses, WINS automatically updates the name database to incorporate DHCP IP address assignments. As computers move from one place (and address) to another on the network, the WINS server automatically updates and maintains their addresses.

Another advantage of using WINS is that it includes NetBIOS name space, which enables it to resolve NetBIOS names into IP addresses. Assume that your computer's NetBIOS name is joeblow, your computer's TCP/IP host name is JoeB, and your domain name is bozos.are.us. A DNS server could only resolve JoeB.bozos.are.us, but a WINS server could resolve JoeB.bozos.are.us and joeblow.bozos.are.us into the correct IP address.

When you configure TCP/IP in Windows NT, you can specify the IP addresses of up to two WINS servers to handle name resolution. If your network uses DHCP, you can configure your workstation to resolve the addresses of WINS servers dynamically by using DHCP.

If you don't have a WINS server available to provide name resolution of NetBIOS computer names to IP addresses (such as resolving your computer's name to its IP address), you can use the LMHOSTS file to resolve NetBIOS names.

Installing and Configuring TCP/IP in Windows NT

Windows NT TCP/IP installs like any other network transport protocol--through the Control Panel. To install TCP/IP, open the Network Properties dialog box; Click Add on the Protocols tab to display the Select Network Protocol dialog box (see Figure 12.1); and then select TCP/IP Protocol from the list. After you close this dialog box, Windows NT prompts you to specify whether you want to use DHCP to assign your IP address. Choose Yes to use DHCP, or No to assign an IP address manually.

Windows NT then prompts you for the location of the Windows NT source files (typically, the Windows NT CD). After you specify the location for the files, Windows NT adds the TCP/IP protocol to your PC, copying files as necessary.

If you have Dial-Up Networking installed on your system, Windows NT prompts you to specify if you want Dial-Up Networking to be configured to use TCP/IP. If you intend to use TCP/IP over a Dial-Up Networking connection, choose OK. Choose Cancel if you intend to use TCP/IP only on a hardwired connection on your LAN.

If you choose OK to enable TCP/IP for Dial-Up Networking, Windows NT displays the Remote Access Setup dialog box. Use this dialog box to specify which port and device you want to use for the dial-up TCP/IP connection. When you've selected and configured the appropriate port, choose Continue. The TCP/IP protocol appears in the Network Protocols list on the Protocols property page.

Fig. 12.1

Select a Network Protocol from this dialog box.

Next, you need to specify a number of settings to properly configure TCP/IP, beginning with the IP address. To do so, choose Close on the Network property sheet. Windows NT will step you through the process of configuring settings for your TCP/IP protocol.


TIP: You can configure and use multiple sets of TCP/IP settings. You can use one configuration for your LAN TCP/IP connection, for example, and specify different settings for each dial-up connection you use. For information on using TCP/IP over a dial-up networking connection, refer to Chapter 15, "Using Remote Access Service (RAS)."

Configuring IP Addressing

When Windows NT first displays the property sheet for the TCP/IP protocol, the IP Address page appears (see Figure 12.2). If you use a static IP address for your workstation, choose the Specify an IP address option button, and then enter the IP address and subnet mask for your workstation in the IP address and Subnet mask text boxes. If you want to rely on a DHCP server or PPP server to assign an IP address automatically for your workstation, choose the Obtain an IP Address From a DHCP Server option button. You do not have to specify the IP address of the DHCP server.

Fig. 12.2

Set basic IP values on the IP Address property page.

If you specify an explicit IP address, take the time to verify that you have entered the correct address and subnet mask before you continue to the other configuration steps.

Configuring a Gateway

If your subnet is connected to other subnets, to other networks, or to the Internet, you must specify at least one default gateway. To do so, click in the Default Gateway box and type the IP address of your default gateway.


TIP: Your network's router typically is the default gateway.

If your network is connected to multiple gateways, you can specify as many gateways as necessary to allow for fault tolerance if one gateway becomes unavailable. To add a gateway, click the Advanced button. In the Advanced IP Addressing dialog box (see Figure 12.3), click the Add button, located under the Gateways group. In the TCP/IP Gateway Address dialog box, type the IP address of the additional gateway, then choose Add. To change the search order for the gateways, use the Up and Down buttons on the Advanced IP Addressing dialog box to change the order of the gateways in the list. The gateways are listed in order of priority. Click OK when you're satisfied with the gateway entries.

Fig. 12.3

Use the Advanced IP Addressing dialog box to specify additional gateways.

Using DNS

If your workstation requires Domain Name System (DNS) services, click the DNS tab to open the DNS property page shown in Figure 12.4.

Fig. 12.4

If your computer needs to use LMHOSTS to resolve network names, you must enable DNS.


Specifying Host and Domain Names. After you enable DNS, you need to specify some additional items of information. First, you need to specify the host name for your computer in the Host Name text box. By default, the host name is your computer's NetBIOS name. You can use any host name, however; for example, you might use your own name as the host name. You can use any combination of letters and numbers, a dash, or a period, but not a space or underscore character, in the host name.

Next, specify the domain name for your network in the Domain text box. TCP/IP combines the host name you specify with the domain name you specify to derive a Fully Qualified Domain Name (FQDN) for your computer. If your host name is JimB and your domain name is que.mcp.com, the FQDN for your computer is JimB.que.mcp.com.


NOTE: Some TCP/IP utilities use your host name, domain name, and FQDN to authenticate your computer name. Note that a computer's FQDN is not the same as a user's e-mail address. Although the FQDN might be JimB.que.mcp.com, the e-mail address might be jboyce@mail.que.mcp.com. Also, a DNS domain name and a Windows NT or LAN Manager domain name are in no way related.

Specifying DNS Server IP Addresses. If you do not use DHCP to define IP addresses, you must provide the IP addresses of the DNS servers you use. If you do use DHCP, the DHCP server can automatically provide the IP addresses of the DNS servers.

You can specify DNS server addresses in the DNS Service Search Order group of controls. First, Determine the IP address of the DNS server you want to use by default. Then, Click the Add button in the DNS Service Search Order control group. Windows NT displays a TCP/IP DNS Server dialog box in which you Enter the IP address of the DNS server. Enter the IP address and choose Add. Windows NT returns to the DNS property page. Repeat the procedure to add other DNS servers, if desired.


NOTE: To change priority of DNS servers in the list, use the Up and Down buttons.

Adding Domain Suffix Entries. Normally, DNS appends the domain name specified in the Domain text box to your host name to resolve the FQDN of your computer. You can specify up to five additional domain suffixes that DNS can use if it can't resolve the FQDN by using the default domain name. A DNS server attempts to resolve the FQDN by using these additional suffixes in alphabetical order (which is how they appear in the list after you add them).

To add additional domain suffixes, enter a domain name in the Domain Suffix Search Order text box, then choose Add. Repeat the process to add additional domain names.

Using WINS

If your network includes one or more Windows NT servers configured as WINS servers, or access to WINS servers, you can configure your Windows NT TCP/IP stack to use WINS to resolve names. WINS offers numerous advantages over DNS, particularly in conjunction with DHCP. To configure WINS, click the WINS Address tab to display the WINS Address property page shown in Figure 12.5.

Fig. 12.5

Use the WINS Address property page to configure WINS settings.

You can specify a primary and a secondary WINS server by entering their IP addresses in the fields provided for that purpose on the property page. If your computer uses DHCP to resolve names, however, you can leave the IP address fields blank, and Windows NT queries the DHCP server for the WINS server addresses.


TIP: Mark the Enable DNS for Windows Resolution check box if you want Windows NT to use the IP address specified on the DNS page to locate the DNS server for Windows networking applications.

When you're satisfied with your TCP/IP settings, choose OK on the Microsoft TCP/IP Properties sheet, and then choose OK on the Network property sheet. Windows NT will perform a binding analysis and bind the TCP/IP protocol as necessary.

Using HOSTS and LMHOSTS Files

DNS name servers resolve FQDN names provided in the host.domain format to IP addresses. A WINS server can resolve IP host.domain names to IP addresses, and it also can resolve a computer's NetBIOS name into its address name. Sometimes, however, being able to resolve names locally without relying on a DNS or WINS name server comes in handy. You might not have a DNS or WINS name server available to you, for example, or the server might be temporarily unavailable.

Windows NT provides two methods for resolving names to IP addresses locally, which you can use in conjunction with or in place of DNS and WINS name resolution. Both methods rely on simple ASCII files to store database entries for names and corresponding IP addresses. The first of these files, HOSTS, resolves DNS-formatted names, and works with or in place of DNS. The second file, LMHOSTS, resolves NetBIOS names into IP addresses, and works with or in place of WINS.

Using the Hosts File for Name Resolution

If you can't access a DNS server, or you want to supplement a DNS server with your own entries, you can use the HOSTS file to maintain a database of host names and their corresponding IP addresses. The HOSTS file is called a host table because it contains a table of host names and their IP addresses. Windows NT can look up entries in the HOSTS file to resolve names.

When you install Windows NT TCP/IP, Windows NT creates a sample HOSTS file named HOSTS.SAM in the \WINNT\system32\drivers\etc folder. The HOSTS.SAM file is an ASCII file that you can edit by using Notepad, WordPad, or any other ASCII editor. You should copy HOSTS.SAM to HOSTS (omitting a file extension) and retain the sample file for future reference in case your HOSTS file becomes corrupted or is accidentally deleted. In other words, edit the HOSTS file, not the HOSTS.SAM file. The following lists the contents of the default HOSTS file:

# Copyright  1993-1995 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows NT.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name deNoted by a `#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

The HOSTS file uses the same format as the hosts file used on 4.3 BSD UNIX, stored in the /etc/hosts file. The HOSTS.SAM file contains comments identified by a leading # character and a single address entry for localhost. The localhost entry is always 127.0.0.1 and is used for loopback testing. You should not change the IP address for localhost or remove it from the HOSTS file.

To add an entry to the HOSTS file, enter the IP address, and then tab to the second column and enter the host name. You can specify more than one host name for an IP address, but you must use multiple entries for the different domains, each with the same IP address, as in the following example:

102.54.94.97     tools.acme.com
102.54.94.97     TOOLS.ACME.COM
102.54.94.97     fooyang.gruel.com

Entries in the HOSTS file are case-sensitive. The two entries for tools.acme.com and TOOLS.ACME.COM would enable the correct host name resolution if you specified the host name in lowercase and uppercase.

You can include a single host name for each entry or specify multiple host names for a single IP address. The following, for example, are valid entries:

198.87.118.72   me              theboss         tower.tigers.k12.cfa.org
198.87.118.50   TheServer       theserver       THESERVER

Each of the entries in this example specify three host names for each IP address.

Windows NT parses the entries in the HOSTS file in sequential order until it finds a match. If you have a large HOSTS file, you can speed up lookup time by placing the most often-used host name entries at the top of the file.

Using the LMHOSTS File for Name Resolution

If you want Windows NT to be able to resolve NetBIOS computer names to IP addresses, you need to use a WINS or LMHOSTS file. NetBIOS names are the computer names assigned to computers on Microsoft-based networks, such as the name you assigned to your computer during setup. As explained previously, your computer's NetBIOS name is not equivalent to your TCP/IP host name, although the two can use the same name.

Windows NT automatically resolves NetBIOS names for computers running TCP/IP on a local network. To resolve IP addresses of computers on other networks to which yours is connected by a gateway (when a WINS server is not available), you need to use LMHOSTS.


NOTE: Like HOSTS, LMHOSTS is an ASCII file, and the format of an entry is similar to entries in a HOSTS file. The LMHOSTS file, however, supports special keywords, which are explained later in this section. Windows NT includes a sample LMHOSTS file named LMHOSTS.SAM, located in the \WINNT\system32\drivers\etc folder. To use LMHosts, copy LMHOSTS.SAM to LMHOSTS without a file extension, then modify LMHOSTS to add entries.

Windows NT TCP/IP reads the LMHOSTS file when you start the computer. As it does the HOSTS file, Windows NT parses each line sequentially, which means you should place often-accessed names at the top of the file for best performance. You also need to place entries that contain special keywords at specific locations in the file (these placement rules are explained later in the section). First, here are a few rules for structuring an LMHOSTS file:


TIP: Although Windows NT TCP/IP reads the LMHOSTS file at system startup, only entries designated as preloaded by the #PRE keyword are read into the name cache at startup. Other entries are read only after broadcast name resolution queries fail.

You can use any or all of six special keywords (described in the following list) in an LMHOSTS file:


NOTE: If you reference a remote LMHOSTS file on a server outside of your network in an #INCLUDE statement, you must include an entry for the IP address of the remote server in the LMHOSTS file. The server's entry must be inserted in the LMHOSTS file before the #INCLUDE statement that references it. You also should not use #INCLUDE to reference an LMHOSTS file on a redirected network drive, because your drive mappings might be different from one session to another. Use the UNC path for the file instead. Centralized LMHOSTS files should never use drive-referenced entries, because the drive mappings in the file probably will not apply to all users who might use the file.
#BEGIN_ALTERNATE 
#INCLUDE        \\server\pub\lmhosts          #Primary source 
#INCLUDE        \\othersrvr\pub\lmhosts       #Alternate source 
#INCLUDE        \\somewhere\pub\lmhosts       #Alternate source 
#END_ALTERNATE

Adding an Entry to LMHOSTS

NetBIOS computer names of computers on your LAN are resolved automatically. To resolve remote names when a WINS server is not available, add the NetBIOS names and their corresponding IP addresses to the LMHOSTS file. To add an entry, use Notepad, WordPad, Edit, or any other text editor that enables you to edit and save ASCII files.

Each line consists of the IP address and NetBIOS name, and also can contain optional keywords and comments as explained previously. The following are examples of LMHOSTS entries:




192.214.240.2     me                               #Alias for my computer
198.87.118.72     tower                            #Fred's computer
198.87.118.50     rli-server  #PRE                 #Application server
120.89.101.70     server      #PRE   #DOM:tigers   #Some comment here
182.212.242.2     sourcesrvr  #PRE                 #Source for shared Lmhosts
182.212.242.3     source2     #PRE                 #Source for shared Lmhosts
182.212.242.4     source3     #PRE                 #Source for shared Lmhosts
187.52.122.188    images                           #Imaging server

#INCLUDE          c:\mystuff\lmhosts               #My private Lmhosts file

#BEGIN_ALTERNATE
#INCLUDE          \\sourcesrvr\pub\Lmhosts         #Primary central Lmhosts
#INCLUDE          \\source2\pub\Lmhosts            #Alternate source
#INCLUDE          \\source3\pub\Lmhosts            #Alternate source
#END_ALTERNATE

In the preceding example, only the rli-server, server, sourcesrvr, source2, and source3 entries are preloaded into the name cache at system startup, because only they include the #PRE keyword. Other entries are parsed only after broadcast name resolution requests fail.


TIP: The addresses of servers you specify in a block inclusion must be preloaded through entries earlier in the file. Any entries not preloaded are ignored.


TROUBLESHOOTING: Sometimes when you're using an LMHOSTS file, it works but takes a relatively long time to connect to some of the systems you use frequently. If you have a large LMHOSTS file, it's likely that the entries you're having trouble with are located near the end of the file. The names are processed sequentially during a resolution search, which means that the entire file has to be parsed before the needed address is reached. Either move to the top of the LMHOSTS file the addresses of the systems you connect most often, or preload the entries as explained previously.


Previous chapterNext chapterContents


Macmillan Computer Publishing USA

© Copyright, Macmillan Computer Publishing. All rights reserved.