Build the Master Server

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 12.  Naming Services and NIS


Now we'll configure the machines that are part of the NIS domain. The first step is to get the master (tin, in this case) up and running.

Let's first set the domain name and also make sure it's retained across reboots by adding it to the /etc/defaultdomain file:

 tin# domainname nis.solarisbootcamp.com tin# domainname > /etc/defaultdomain tin# domainname nis.solarisbootcamp.com tin# 

Now let's run ypinit to initialize the master. This will prompt us to enter the list of servers we will use, so we'll add them all at this point. This information is stored in a map named ypservers, which is known as the server map. For now we'll add the servers to this map by passing them onto ypinit, but later we'll see how to update the map manually:

[View full width]

tin# ypinit -m In order for NIS to operate sucessfully, we have to construct a list of the NIS servers. graphics/ccc.gifPlease continue to add the names for YP servers in order of preference, one per line. graphics/ccc.gifWhen you are done with the list, type a <control D> or a return on a line by itself. next host to add: tin next host to add: fluorine next host to add: iodine next host to add: The current list of yp servers looks like this: tin fluorine iodine Is this correct? [y/n: 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] OK, please remember to go back and redo manually whatever fails. If you don't, some part graphics/ccc.gifof the system (perhaps the yp itself) won't work. The yp domain directory is /var/yp/nis.solarisbootcamp.com There will be no further questions. The remainder of the procedure should take 5 to 10 graphics/ccc.gifminutes. Building /var/yp/nis.solarisbootcamp.com/ypservers... Running /var/yp /Makefile... updated passwd updated group updated hosts make: Warning: Don't know how to make target `/etc/ethers' Current working directory /var/yp <lines removed for clarity> updated auto.home make: Warning: Target `all' not remade because of errors Current working directory /var/yp tin 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 graphics/ccc.gifchanged. If there are no running slaves, run ypinit on those hosts which are to be slave graphics/ccc.gifservers. tin#

The output from ypinit shows that make reported an error while trying to access some of the files, including /etc/ethers. It's not a problem in this case, as it simply indicates that the files couldn't be found (they don't exist by default). If we wish, we could create an empty file to get rid of these types of errors, as shown below:

 tin# touch /etc/ethers tin# cd /var/yp tin# make ethers updated ethers pushed ethers tin# 

Now that we have initialized the master server, we can start the main processes. We'll do this manually now, but it will normally be carried out automatically at boot time:

 tin# /usr/lib/netsvc/yp/ypstart starting NIS (YP server) services: ypserv ypbind ypxfrd rpc.yppasswdd rpc.ypupdated done tin# 

This shows that all the servers have been correctly started. As a secondary check, we can look in the messages file to make sure we don't have any NIS errors.

If everything appears to be OK, we'll check which server we are bound to. Hopefully, it will be tin, since it's the only server at the moment!

 tin# ypwhich tin tin# 

Good. This shows that ypbind is successfully communicating with ypserv. So let's query the server for its list of available maps:

 tin# ypwhich -m auto.home tin hosts.byaddr tin hosts.byname tin <lines removed for clarity> ypservers tin tin# 

So what have we actually done by creating the master? If we look in the NIS directory, /var/yp, we can see that a directory has been created with the name of the domain it's serving"nis.solarisbootcamp.com."

 tin# cd /var/yp tin# ls -ld nis.Solarisbootcamp.com drwxr-xr-x   2 root     other       1536 Aug  1 12:02 nis.solarisbootcamp.com tin# 

If we look in this directory we can see that it contains all the relevant NIS files for the domain, including any variations that are required to allow us to perform lookups using different keys such as hosts.byaddr and hosts.byname:

 tin# cd nis.solarisbootcamp.com tin# ls auto.home.dir               networks.byname.dir auto.home.pag               networks.byname.pag group.bygid.dir             passwd.byname.dir group.bygid.pag             passwd.byname.pag group.byname.dir            passwd.byuid.dir group.byname.pag            passwd.byuid.pag hosts.byaddr.dir            protocols.byname.dir hosts.byaddr.pag            protocols.byname.pag hosts.byname.dir            protocols.bynumber.dir hosts.byname.pag            protocols.bynumber.pag mail.aliases.db             publickey.byname.dir mail.aliases.dir            publickey.byname.pag mail.aliases.pag            rpc.bynumber.dir mail.byaddr.dir             rpc.bynumber.pag mail.byaddr.pag             services.byname.dir netid.byname.dir            services.byname.pag netid.byname.pag            services.byservicename.dir netmasks.byaddr.dir         services.byservicename.pag netmasks.byaddr.pag         ypservers.dir networks.byaddr.dir         ypservers.pag networks.byaddr.pag tin# 

Looking back in /var/yp, we see the binding directory. If we follow this tree we'll find the file ypservers. We explained earlier that this contains the name of the server that the client was last bound to, and that it will try to bind to for subsequent reboots. If we look at it we can see it contains our own hostnameagain, we are the only configured server so it couldn't contain anything else at this point. Later we should see that different clients bind to different servers:

 tin# cat /var/yp/binding/nis.solarisbootcamp.com/ypservers tin tin# 

Everything seems to be working OK as far as NIS is concerned, so let's alter the switch file to make it our default naming service. We'll use the NIS template file as explained earlier in the section "Name Service Switch File" on page 280:

 tin# cp /etc/nsswitch.nis /etc/nsswitch.conf tin# 

Good. The master is now configured for NIS, so we can move on to the next machines.


    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net