Вы находитесь на странице: 1из 4

Below procedure gives the steps to configure NIS Master Server, Slave Server and Client services in both

solaris 9 and Solaris 10

Configuring NIS Master Server


You must login as root.
1. Define the NIS domainname.
# domainname example-domain > example-domain is the domain name. It could be any name you like.
2. Populate the /etc/defaultdomain file with the domainname.
# domainname > /etc/defaultdomain
3. Edit the /etc/hosts file to ensure that the NIS master and all NIS slave servers have been defined and that a fully qualified name
exists for this server.
4. Optionally, create an alternate directory and copy the source files there.
# mkdir /var/yp/src
# cd /etc
# cp auto_home auto_master bootparams ethers group hosts netgroup netmasks networks passwd protocols publickey rpc
services shadow timezone user_attr /var/yp/src
5. Edit the Makefile.
# cp /var/yp/Makefile /var/yp/Makefile.orig
# vi /var/yp/Makefile
Modify DIR= and PWDIR= entries to reflect the location of the alternate directory used in step 4.
Example: DIR=/var/yp/src
Example: PWDIR=/var/yp/src
If you wish NIS to resolve hosts through DNS comment out B= and uncomment
B=-b.
Locate the target labeled all: and remove any map from the definition that does not have a corresponding file and will not be used
as part of this service.
For example, bootparams,ethers, and timezone files do not exist by default, and may be removed. This will avert errors during the
make process ( i.e. make: Fatal error: Command failed for target k).
Note: If the netgroup map is to be used later, but does not yet exist, create a placeholder for this in the target directory.
# touch /var/yp/src/netgroup
Note: To relocate RBAC related files or /etc/inet/ipnodes consult the comments in /var/yp/Makefile.
6. Ensure files are selected as the naming service, if not previously defined.
# cp /etc/nsswitch.files /etc/nsswitch.conf
7. Initialize the server:
# cd /var/yp
# /usr/sbin/ypinit -m
It will ask you for the other yp servers name. Type the name of the server you are working on, along with the name of your NIS
slave servers, and then press CTRL-D.It will ask the question Do you want this procedure to quit on non-fatal errors [y/n:n]n.
choose n.
8. Start the NIS daemons.
# /usr/lib/netsvc/yp/ypstart
This will start all NIS server daemons (ypbind ypserv ypxfrd rpc.yppasswdd rpc.ypupdated ).

# ps ef |grep yp
/usr/lib/netsvc/yp/ypbind
/usr/lib/netsvc/yp/ypserv -d
/usr/lib/netsvc/yp/ypxfrd
/usr/lib/netsvc/yp/rpc.yppasswdd -D /var/yp/src -m
/usr/lib/netsvc/yp/rpc.ypupdated
Note: For Solaris 10, ypstart is automatically invoked from ypinit -m. Use the svcs utility to view the state of the services.
# /usr/bin/svcs \*nis\*
STATE

STIME FMRI

disabled

13:14:59 svc:/network/rpc/nisplus:default

online

13:28:34 svc:/network/nis/server:default

online

13:28:34 svc:/network/nis/xfr:default

online

13:28:34 svc:/network/nis/update:default

online

13:28:34 svc:/network/nis/passwd:default

online

13:28:35 svc:/network/nis/client:default

9. Test the configuration.


# cd /var/yp
# /usr/ccs/bin/make (this should complete without errors)
# ypcat -k hosts

(to make sure the new maps are there)

# ypwhich -m

(display the maps that are being served)

NOTE: All the resulting NIS maps will be stored under /var/yp/example-domain directory.
10. To enable this host as a NIS client.
# cp /etc/nsswitch.nis /etc/nsswitch.conf
Edit /etc/nsswitch.conf as necessary (ie. add dns entry).
Note: To control NIS services from the command line:
# /usr/lib/netsvc/yp/ypstop (to stop NIS services)
# /usr/lib/netsvc/yp/ypstart (to start NIS services)
For Solaris 10, you can use:
# ypstop
or
# svcadm disable network/nis/server:default
# svcadm disable network/nis/client:default
# ypstart
or
# svcadm enable network/nis/server:default
# svcadm enable network/nis/client:default
# ypstop; ypstart (restart NIS Services)
or
# svcadm restart network/nis/server:default
# svcadm restart network/nis/client:default
Note: See man page securenets(4) for restricting access and use of /var/yp/securenets file.

Configuring NIS Slave Server


You must login as root.
1. # domainname example-domain > example-domain is the domainname. It must be the same domainname as you have in
NIS master.
2. Populate the /etc/defaultdomain file with the domainname.
# domainname > /etc/defaultdomain
3. Edit the /etc/hosts file to ensure that the NIS master and all NIS slave servers have been defined.
4. # cp /etc/nsswitch.nis /etc/nsswitch.conf
Edit /etc/nsswitch.conf as necessary (ie. add dns entry).
5. # /usr/sbin/ypinit -c
Above command initialize the slave server as a client first. The ypinit command prompts you for a list of NIS servers. Enter the
name of the local slave you are working on first, then the master server, followed by the other NIS servers in your domain in order
from the physically closest to the furthermost (in network team), then press CTRL-D.
6. Make sure ypbind is not running.
# ps -ef | grep ypbind
7. Start ypbind
# /usr/lib/netsvc/yp/ypstart
8. Initialize this machine as a slave and transfer the NIS maps.
# /usr/sbin/ypinit -s master_machine_name
9. Stop ypbind.
# /usr/lib/netsvc/yp/ypstop
10. Start ypbind and ypserv.
# /usr/lib/netsvc/yp/ypstart
Note for Solaris 10, you can use:
# ypstop
or
# svcadm disable network/nis/server:default
# svcadm disable network/nis/client:default
# ypstart
or
# svcadm enable network/nis/server:default
# svcadm enable network/nis/client:default
# ypstop; ypstart (restart NIS Services)
or
# svcadm restart network/nis/server:default
# svcadm restart network/nis/client:default
Note: See the man page securenets(4) for restricting access and use of /var/yp/securenets file.

Configuring NIS Client


You must login as root.
1. # domainname example-domain > example-domain is the domainname. It must be the same domainname as you have in
NIS master and slave.

2. Populate the /etc/defaultdomain file with the domainname.


# domainname > /etc/defaultdomain
3. Edit the /etc/hosts file to ensure that the NIS master and all NIS slave servers have been defined.
4. # cp /etc/nsswitch.nis /etc/nsswitch.conf
Edit /etc/nsswitch.conf as necessary (ie. add dns entry).
5. # /usr/sbin/ypinit -c
Above command initializes the slave server as a client. You will be asked to name NIS servers from which the client may obtain
nameservice information. You may list as many master or slave servers as you want. The servers that you list can be located
anywhere in the domain. It is good practice to first list the servers closest (in net terms) to the machine, then those that are on more
distant parts of the net, then press CTRL-D.
6. Start ypbind.
# /usr/lib/netsvc/yp/ypstart

Note for Solaris 10, you can use:

# ypstop
or
# svcadm disable network/nis/client:default
# ypstart
or
# svcadm enable network/nis/client:default
# ypstop; ypstart
or
# svcadm restart network/nis/client:default

7. ypwhich m
On the newly configured NIS client, test the NIS functionality by the above command. The output should include the name of the
NIS master server along with the database maps its serving.

Вам также может понравиться