NFS Services Administrator's Guide

Configuring and Administering NIS
Configuring and Administering an NIS Master Server
Chapter 4 157
To Create the Master hosts File
1. Copy the /etc/hosts file from each host in your NIS domain to the
/etc directory on the host that will be the master server. Name each
copy /etc/hosts.hostname, where hostname is the name of the host
it came from.
2. Concatenate all the hosts files together, including the master
server’s hosts file, into a temporary hosts file, as follows:
cd /etc
cat hosts hosts.hostname1 hosts.hostname2... > hosts.temp
3. Issue the following command to sort the temporary hosts file so that
duplicate IP addresses are on adjacent lines:
sort -o /etc/hosts.temp /etc/hosts.temp
4. Examine /etc/hosts.temp for duplicate IP addresses. If the same
IP address appears in multiple entries, remove all the entries but
one. If you need to map an IP address to multiple host names, include
them as aliases in a single entry.
5. Issue the following command to sort the temporary hosts file by host
name:
sort -o /etc/hosts.temp -b -k2,2 /etc/hosts.temp
6. Examine /etc/hosts.temp for duplicate host names. A host name
may be mapped to multiple IP addresses only if the IP addresses
belong to different LAN cards on the same host. If a host name
appears in multiple entries, mapped to IP addresses on different
hosts, remove all the entries but one.
7. Examine /etc/hosts.temp for duplicate aliases. No alias should
appear in more than one entry.
8. Move /etc/hosts.temp (the sorted, edited file) to /etc/hosts. This
file will be used to generate the hosts map for your NIS domain.
9. Remove the /etc/hosts.hostname files from the master server.
NOTE NIS does not require that the hosts file be sorted in any particular way.
Sorting the hosts file simply makes it easier to find duplicate entries.