How do I set up a server to service multiple NIS domains?
Perform a repetitive two-fold process depending on the number
of domains you wish the server to service.
1) Set the first domain by typing:
#domainname <domain>
2) Configure the server as a slave or master (ypinit -m or ypinit -s)
3) Set the second domain by typing:
#domainname <domain>"
4) Configure the server as a slave or master (ypinit -m or ypinit -s)
5) Set the third domain by typing:
#domainname <domain>"
6) Configure the server as a slave or master (ypinit -m or ypinit -s)
etc..............
Let me give an actual example:
Consider the following NIS environment:
1 NIS master and 2 clients. In this case, all two machines have 2.6 as an OS.
Generally, it shouldn't matter which OS.
The master is to service 2 domains. Each of the clients is in different
domains.
On the master:
#domainname galaxy.com
#domainname
galaxy.com
#cd /var/yp
#ls
Makefile aliases binding nicknames galaxy
NOTE: In the Makefile, I made some changes to DIR and PWDIR.
DIR =/var/yp/galaxy
PWDIR =/var/yp/galaxy
I created a directory under /var/yp called galaxy. I copied the necessary files
needed from /etc to /var/yp/galaxy. I did this for the convenience of
distinguishing
which files I have in each domain. Some choose to use /etc. It depends on your
setup.
#ls /var/yp/galaxy
aliases auto_master hosts networks publickey services
timezone
auto_home group netmasks passwd rpc shadow
#ypinit -m
In order for NIS to operate sucessfully, we have to construct a list of the
NIS servers. Please continue to add the names for YP servers in order of
preference, one per line. When you are done with the list, type a <control D>
or a return on a line by itself.
next host to add: kakata
next host to add:
The current list of yp servers looks like this:
kakata
Is this correct? [y/n: y] y
Installing the YP database will require that you answer a few questions.
Questions will all be asked at the beginning of the procedure.
Do you want this procedure to quit on non-fatal errors? [y/n: n] y
The yp domain directory is /var/yp/galaxy.com
There will be no further questions. The remainder of the procedure should take
5 to 10 minutes.
.
.
.
kakata has been set up as a yp master server without any errors.
If there are running slave yp servers, run yppush now for any data bases
which have been changed. If there are no running slaves, run ypinit on
those hosts which are to be slave servers.
#ls
Makefile auto.master.time group.time networks.time
rpc.time
aliases binding hosts.time nicknames
services.time
aliases.time netid.time passwd.time timezone.time
auto.home.time
galaxy.com galaxy netmasks.time publickey.time
#/usr/lib/netsvc/yp/ypstart
starting NIS (YP server) services: ypserv ypbind ypxfrd rpc.yppasswdd done.
#domainname test.net
#domainname
test.net
#pwd
/var/yp
NOTE: Again, in the makefile, I made some changes to DIR and PWDIR.
DIR =/var/yp/testnet
PWDIR =/var/yp/testnet
I created a directory under /var/yp called testnet. I copied the necessary
files
needed from /etc to /var/yp/testnet. I did this for the convenience of
distinguishing
which files I have in each domain. Some chose to use /etc. It depends on your
setup.
#ls /var/yp/testnet
aliases auto_master hosts networks publickey services
timezone
auto_home group netmasks passwd rpc shadow
#ypinit -m
(same output as previous ypinit -m except for the domainname)
.
.
.
.
.
#pwd
/var/yp
#ls
Makefile auto.master.time group.time networks.time
rpc.time
test.net aliases binding hosts.time nicknames
services.time aliases.time netid.time passwd.time
timezone.time
auto.home.time galaxy galaxy.com netmasks.time publickey.time
testnet test.net
#
Continue the process for as many domains as you wish.
On the clients, all that is necessary is to set the domain
and run the ypinit script. Observe:
# domainname galaxy.com
# domainname
galaxy.com
#cd /var/yp
#ls
aliases binding nicknames
# ypinit -c
In order for NIS to operate sucessfully, we have to construct a list of the
NIS servers. Please continue to add the names for YP servers in order of
preference, one per line. When you are done with the list, type a <control D>
or a return on a line by itself.
next host to add: kakata
next host to add:
The current list of yp servers looks like this:
kakata
Is this correct? [y/n: y] y
#cd /var/yp/binding
#ls
galaxy.com xprt.tcp.1 xprt.ticots.3 xprt.udp.3
xprt.tcp.2 xprt.ticotsord.3 ypbind.pid
xprt.tcp.3 xprt.udp.1 xprt.ticlts.3 xprt.udp.2
#ypbind
#ypwhich
kakata
#ypcat -k hosts
abc 129.x.x.x abc
cbs 129.x.x.x cbs
nbc 129.x.x.x nbc
Of course, I masked out the octets with x's and changed the names.
Good Luck!!!!