• No results found

If your NIS system is already running, just build the maps with the make command:

Area Border Routers

STEP 3 - Create New Maps

1. If your NIS system is already running, just build the maps with the make command:

cd /var/yp make Makefile

2. If your NIS system is not active, issue these commands:

domainname my_domain ypinit -m

You can use sam or the shell commands. If you use the shell commands, you must edit the NIS variables in the configuration file /etc/rc.config.d/namesvrs in order to activate NIS at next boot time. To do this, change the following entries to the values shown:

NIS_MASTER_SERVER=1 NIS_CLIENT=1

NIS_DOMAIN=domain_name

5-15 H1690S A.03

© Hewlett-Packard Co.

5-9. SLIDE: Propagating NIS Maps with ypxfr

Student Notes

The ypxfr command copies a NIS map (database) to the local host from a NIS server by using the NIS services. A map can be copied regardless of its age, or it can be copied depending on whether its modification time (order number) is more recent than that of the local map.

The ypxfr command creates a temporary map in the directory /var/yp/domain where domain is the NIS domain. The ypxfr command fills the map with entries from the specified map, obtains the map parameters (master and order number), and loads them. It then clears the old version of the map and moves the temporary map to the cleared location.

For example, to copy an updated automounter map from the master server to a slave server, log in as root on the slave server and issue this command:

/usr/sbin/ypxfr auto.mapname

5-10. SLIDE: ypxfr Examples

Student Notes

To maintain consistency between NIS servers, ypxfr should be executed periodically for every map in the NIS. Different maps change at different rates. For example, the

services.byname map may not change for months at a time, and might therefore be checked for changes only once a day, such as in the early morning hours. However, passwd.byname may change several times per day, so hourly checks for updates might be more appropriate.

5-17 H1690S A.03

© Hewlett-Packard Co.

having a separate crontab file for each map, ypxfr requests can be grouped in a shell script to update several maps at once. Example scripts (mnemonically named) are in /var/yp:

ypxfr_2perday

ypxfr_1perday

ypxfr_1perhour

They serve as reasonable rough drafts that can be changed as appropriate. For example, the default version of ypxfr_1perhour contains:

# @(#)ypxfr_1perday: $Revision: 1.1.211.1 $ $Date: 96/10/09 11:27:17 $

#

# (c) Copyright 1987, 1988 Hewlett-Packard Company

# (c) Copyright 1985 Sun Microsystems, Inc.

#

# ypxfr_1perday - Do daily Network Information Service map check/updates /usr/sbin/ypxfr group.bygid

5-11. LAB: NFS Automount Using NIS Maps

Directions

In this lab, two systems make up a group. Both systems establish a NIS domain: one as the NIS client; the other as the NIS server.

Each NIS domain has two users: Romeo and Juliet.

Physically, Romeo’s home directory is located on the NIS server, and Juliet’s home directory is located on the NIS client.

Each physical home directory is located in the subdirectory /export/balcony /export/balcony/juliet on the NIS client for Juliet

/export/balcony/romeo on the NIS server for Romeo

The watch point for the automount daemon is /balcony where the automount will create the symbolic links. To avoid conflicts with the /home directory and existing accounts, we will use /balcony as the home directory for Romeo and Juliet instead of /home.

Juliet’s login directory is /balcony/juliet Romeo’s login directory is /balcony/romeo

In other words the /etc/passwd entries for the home directories should be /balcony/juliet for Juliet

/balcony/romeo for Romeo.

In reality these directories are symbolic links created by the automount daemon.

1. Define the Necessary User Environment

On the NIS server, define the two users. Suggestion: SAM is a good tool to use for defining the users, but you must adjust the home directories and the /etc/passwd file manually.

Remember, although both Juliet and Romeo are configured in the NIS passwd map on the NIS server, the physical home directory of Juliet is located on the NIS client, and the physical home directory of Romeo is located on the NIS server.

5-19 H1690S A.03

© Hewlett-Packard Co.

/etc/rc.config.d/nfsconf file:

2. Using either vipw or vi, edit the /etc/passwd file to change the home directories to /balcony/juliet and /balcony/romeo, respectively.

3. For Juliet, copy the entire home directory /export/balcony/juliet from the NIS server to the NIS client. You can best accomplish this task by using a remote shell and the tar command:

4. Create the Source Files for the NIS Automount Maps Configure the automount configuration files in the following way:

On the NIS client, mount /export/balcony/juliet at /balcony/juliet. On the NIS server, mount /export/balcony/romeo at /balcony/romeo.

These files will serve as source files only for the NIS maps. The automount daemon should request both maps via NIS.

For configuration files, use the following:

/etc/auto_master and /etc/auto_home

Assuming that paris is the NIS client and geneve is the NIS server, what will your configuration files look like?

5. Extend the files /var/yp/Makefile so that the /etc/auto_home file will be built as the auto.home NIS map.

6. Configure Each System as an NFS Server

Both the NIS client and the NIS server function as the NFS server for Juliet’s and Romeo’s home directories, respectively. On both systems, export the appropriate file systems. Then activate the NFS server daemons on each system. This is done automatically if you use a tool such as SAM.

7. Configure NIS

On each system configure the NIS domain, including both the NIS client and the NIS server.

(If you want to continue with the Shakepearean theme, Montague, Capulet, Benvolio, Mercutio, Tybalt, and Verona are good selections.)

8. Activate the Automount Daemon

On both systems, determine if the automount daemon is running. If it is running, stop it. Do not use the signal 9 to stop the automount daemon!

Restart the automount by using the -v option. You want the automount daemon to read the NIS master map instead of the local /etc/auto_master file.

If you get an error, look at the var/adm/syslog/* file.

What does the -v option do?

5-21 H1690S A.03

© Hewlett-Packard Co.

9. Test Your Automount Configuration

On both systems login as Juliet and as Romeo. On the NIS client create a test file to check the correct configuration.

Do you see the test file on the NIS server also?

Are you logged into the correct home directory?

Where are the home directories physically located?

Using the mount command, look at the mount table.