Friday, April 20, 2007

Files Reference - hosts File Format for TCP/IP

Files Reference - hosts File Format for TCP/IP


In these examples, the name of the local host is the first line in each hosts file. This is to help you identify the host whose file is being displayed. Your host does not have to be defined on the first line of your hosts file.
The following sample entries might be contained in the hosts files for two different hosts on a network that is not running a DOMAIN name server:

Host1
185.300.10.1 host1
185.300.10.2 host2
185.300.10.3 host3
185.300.10.4 host4 merlin
185.300.10.5 host5 arthur king
185.300.10.5 timeserver

Host 2

185.300.10.2 host2
185.300.10.1 host1
185.300.10.3 host3
185.300.10.4 host4 merlin
185.300.10.5 host5 arthur king

In this sample network with no name server, the hosts file for each host must contain the Internet address and host name for each host on the network. Any host that is not listed cannot be accessed. The host at Internet address 185.300.10.4 in this example can be accessed by either name: host4 or merlin. The host at Internet address 185.300.10.5 can be accessed by any of the names host5, arthur, or king.
Following is a sample entry in the hosts files for a different host on a DOMAIN network, but the host is not the name server, and the host is keeping some additional host names for a smaller network:

Host 5
128.114.1.15 name1.xyz.aus.century.com name1
128.114.1.14 name2.xyz.aus.century.com name2
128.114.1.16 name3.xyz.aus.century.com name3

In this sample, host5 is not a name server, but is attached to a DOMAIN network. The hosts file for host5 contains address entries for all hosts in the smaller network, and the DOMAIN data files contain the DOMAIN database. The entries in thehost5 hosts file that begin with 128.114 indicate that host5 resolves names for hosts on the smaller network.