When first getting started with TCP/IP, most organizations simply use IP addresses to access the local hosts on their network. However, as they begin to further deploy TCP/IP, they begin to use the HOSTS files on each system as a way to easily reference hosts by name instead of by number.
Most TCP/IP products offer this capability, and provide a sample file called HOSTS or HOSTS.TXT that can be used for this purpose. With Windows 95 and Windows NT, this file is called HOSTS.SAM and is in the C:\WINDOWS directory. This file must be renamed to HOSTS (not "HOSTS.TXT" or anything else) and edited prior to your being able to use it. On NetWare, this file is called HOSTS and is in the SYS:/ETC directory.
The format for a HOSTS file is fairly standard across most implementations. There is one column of IP addresses, a column of host names, and several columns of alias names for that host. These alias names provide an ability to assign a single host several different names. Additionally, most TCP/IP implementations allow for comments to be added to any of these lines through the use of "#" marks; anything after the "#" is considered to be a comment and is ignored.
In the NetWare 4.x server environment, the first column is used for the host's IP address, the second column is used for that host's primary hostname, and the third and subsequent columns are used for aliases.
An example HOSTS file follows in Figure C.1 below:
# # "IP Address" "Hostname" "Aliases" "#Comments" # 127.0.0.1 localhost loopback 204.217.177.75 Server1 www mail #engineering server 204.217.177.76 Server2 #marketing server 204.217.177.77 Joes-PC Joe 204.217.177.78 Marys-Mac Mary
The first three lines begin with a "#" mark, which indicates that they are comments and should be ignored by the applications that are looking through the file. The second line is a comment for your benefit that defines the format of the file, so that you don't forget.
The rest of the file consists of addresses and their associated host names. The first entry is one that references the local host that the software is running on. The IP address of 127.0.0.1 and the host names of "localhost" and "loopback" should be in every HOSTS file across your organization, even if you run DNS servers. This number and these names are standard components of TCP/IP, and many applications will not work without these entries.
The next two entries are for local servers. The first one references the host named SERVER1, which is at 204.217.177.75, and the second one references the host named SERVER2, which has 204.217.177.75 as its IP address. Whenever a user attempts to access a host named SERVER1, then the local IP stack will interpret that to mean the IP address of 204.217.177.75. Note that both lines have comments indicating the departments they are located in.
Notice also that SERVER1 has alias host names of "WWW" and "MAIL". This allows this server to be linked to these host names as well. If a user were to point their web browser at "WWW" then the IP stack would open a connection to 204.217.177.75. If for some reason the local administrator wished to move the web server software to SERVER2, then they would need to update all of the HOSTS files across their organization so that SERVER2 had the WWW alias entry. The use of aliases increases your networks flexibility tremendously, and should be leveraged.
An important point to note here is that in order for this alias modification to take effect, the administrator would have to visit each and every system in the organization and update the HOSTS file on those systems. Although this is feasible for a handful of systems, it becomes unwieldy at best with more than a dozen or so hosts. At this point, DNS is a better choice for the local network, as it allows for a single change to be made at a central server, and all of the clients will see the change immediately. DNS also allows you to participate in the Internet's distributed naming mechanisms as well.
For more information on the SERVICES database file, refer to section C.2.2 SERVICES. For more information on the NETWORKS database file, refer to section C.2.3 NETWORKS. For more information on DNS, refer to section C.3 The Domain Name System (DNS).
Copyright © 1997, Unoverica Corporation. All rights reserved. Unauthorized use prohibited.
Send comments to docs@unoverica.com