Table of ContentsLibraryView in Frames

Creating /etc/hosts from the NIS master

You can create a host file remotely and modify your storage system's NIS master to install the host file in the /etc directory. This method is useful if you have many entries in your host file.

Steps

  1. On the NIS server, open the NIS makefile with an editor.
  2. Locate the section for hosts.time.
  3. Add the following lines at the end of the hosts.time section, replacing dirname with a directory name of your choice, and toaster 1, toaster2, and so on with names of your storage systems: @mntdir=/tmp/dirname_etc_mnt_$$$$;\ if [ ! -d $$mntdir ]; then rm -f $$mntdir; \ mkdir $$mntdir; fi;\ for s_system in toaster1 toaster2 toaster3 ; do \ mount $$s_system:/etc $$mntdir;\ mv $$mntdir/hosts $$mntdir/hosts.bak;\ cp /etc/hosts $$mntdir/hosts;\ umount $$mntdir;\ done;\ rmdir $$mntdir
  4. Save the NIS makefile.

    The /etc/hosts file on your storage system is updated whenever the NIS makefile is run.