InomHitta mer dokumentationSupportresurser som ingår | Ladda ner denna bok i PDF (477 KB)
Part III NIS Setup and ConfigurationThis part describes how to set up and configure the Network Information Service (NIS) service. It has one chapter.
Chapter 10 Configuring NIS ServiceThis chapter describes initial set up and configuration of the Network Information Service (NIS). See Solaris Naming Administration Guide for a general description and overview of NIS. NIS in the Solaris 2.6 releaseThe following NIS features are new or different in Solaris 2.6 release. NSKit DiscontinuedThe most recent Solaris releases have not included NIS service. Up to now, NIS service had to be installed from the unbundled NSKit. NIS has now been included in the base Solaris 2.6 release, and there is no 2.6-level NSKit. Because NIS service is now part of the base Solaris 2.6 release, the SUNWnsktu and SUNWnsktr packages no longer exist. Instead, NIS is now installed via the Solaris 2.6 release SUNWypu and SUNWypr packages. NIS service is no longer started with the /etc/init.d/yp script, which no longer exists. With the Solaris 2.6 release, you first configure your master server NIS maps with the ypinit script, then start NIS with the /usr/lib/netsvc/yp/ypstart script (these steps are described in detail in the following sections of this chapter). NIS service is stopped with the ypstop command. Enhanced ypupdated DaemonThe most recent versions of NSKit did not include the ypupdated daemon. The ypupdated daemon is now included in this Solaris release. Before You Begin Configuring NISBefore configuring your NIS namespace, you must:
Planning Your NIS DomainBefore you configure machines as NIS servers or clients, you must plan the NIS domain. Planning the DomainDecide which machines will be in your NIS domain(s). A NIS domain does not have to be congruent with your network. A network may have more than one NIS domain, and there can be machines on your network that are outside of your NIS domain(s). Choose a NIS domain name. A NIS domain name may be up to 256 characters long, though much shorter names are more practical. A good practice is to limit domain names to no more than 32 characters. Domain names are case-sensitive. For convenience, you can use your Internet domain name as the basis for your NIS domain name. For example, if your Internet domain name is doc.com, you can name your NIS domain doc.com. If you wanted to divide doc.com into two NIS domains, one for the sales department and the other for the manufacturing department, you could name one sales.doc.com and the other manf.doc.com. Before a machine can use NIS services, the correct NIS domain name and machine name must be set. A machine's name is set by the machine's /etc/nodename file and the machine's domain name is set by the machine's /etc/defaultdomain file. These files are read at boot time and the contents are used by the uname -S and domainname commands, respectively. (Diskless machines read these files from their boot server.) Identify Your NIS ServersDecide which machines will be NIS servers. Select one machine to be the master server (you can always change this at a later date). Decide which machines, if any, will be slave servers. (See Solaris Naming Administration Guide for a general overview of NIS and NIS requirements.) Identify Your NIS Client MachinesDecide which machines will be NIS clients. Typically all machines in your domain are set to be NIS clients, although this is not strictly necessary. NIS Configuration StepsWhen your Solaris 2.6 release software and nsswitch.conf files are installed, and your domain planned, you must perform the following steps to configure NIS:
Note - In some contexts, machine names are referred to as host names or workstation names. This discussion uses "machine," but some screen messages or NIS map names may use host or workstation. The following sections explain these steps in detail. Preparing the Master ServerSetting up the master server involves converting the source (input) text files on the master into NIS master server maps. Before doing this, however, you need to take several precautions. Source Files DirectoryThe source files may be located either in the /etc directory on the master server or in some other directory. Having them in /etc may be undesirable because the contents of the maps are then the same as the contents of the local files on the master server. This is a special problem for passwd and shadow files, because all users would have access to the master server maps and the root password would be passed to all YP clients through the passwd map (see "Passwd Files and Namespace Security" for additional information on this subject). However, if you choose to locate the source files in some other directory, you must modify the Makefile in /var/yp by changing the DIR=/etc line to DIR=/your-choice, where your-choice is the name of the directory you will be using to store the source files. This allows you to treat the local files on the server as if they were those of a client. (It is good practice to first save a copy of the original makefile.) Passwd Files and Namespace SecurityThe passwd map is a special case. In addition to the old Solaris 1.x passwd file format, this implementation of NIS accepts the Solaris 2.x release /etc/passwd and /etc/shadow file format as input for building the NIS password maps. For security reasons, the files used to build the NIS password maps should not contain an entry for root, to prevent unauthorized root access. Therefore, the password maps should not be built from the files located in the master server's /etc directory. The password files used to build the password maps should have the root entry removed from them and be located in a directory that can be protected from unauthorized access. For example, the master server password input files should be stored in a directory such as /var/yp, or any directory of your choice, as long as the file itself is not a link to another file and its location is specified in the Makefile. The /usr/lib/netsvc/yp/ypstart script automatically sets the correct directory option according to the configuration specified in your Makefile. If your source files are in a directory other than /etc, you must alter the Be sure that the passwd file in the directory specified by Source FilesPrepare the source files for conversion to NIS maps.
Preparing the MakefileAfter checking the source files and copying them into the source file directory, you now need to convert those source files into the ndbm format maps that the NIS service uses. This is done automatically for you by ypinit when called on the master server, as explained in the next section, "Setting Up the Master Server With ypinit". The ypinit script calls the program make, which uses the Makefile located in the /var/yp directory. A default Makefile similar to Example 10-1 is provided for you in the /var/yp directory and contains the commands needed to transform the source files into the desired ndbm format maps. You can use the default Makefile as it is, or modify it if you want. (If you do modify the default Makefile, be sure to first copy and store the original default Makefile in case you need it for future use.) You may need to make one or more of the following modifications to the Makefile:
Example 10-1 Default Makefile Before Modification
The function of the Makefile is to create the appropriate NIS maps for each of the databases listed under all. After passing through makedbm the data is collected in two files, mapname.dir and mapname.pag, both in the /var/yp/domainname directory on the master server. The Makefile builds passwd maps from the /PWDIR/passwd, /PWDIR/shadow, and /PWDIR/security/passwd.adjunct files, as appropriate. Setting Up the Master Server With ypinitThe /usr/sbin/ypinit shell script sets up master and slave servers and clients to use NIS. It also initially runs make to create the maps on the master server. To use ypinit to build a fresh set of NIS maps on the master server, follow these steps:
Master Supporting Multiple NIS DomainsNormally, a NIS master server supports only one NIS domain. However, if you are using a master server to support multiple domains, you must modify the steps slightly, as described in the section above, when setting up the server to serve the additional domains. Run the domainname command on the server. The domain name returned by the command is the server's default domain. The steps described in the section above will work properly for setting up service for that domain. To configure service for any other domain, you must modify the ypinit shell script as follows:
Where correct-domain is the name of the other domain that you are setting up service for, and passwd is the make target. This command pushes the password map to the intended domain, instead of the domain to which the master belongs. Starting NIS Service on the Master ServerNow that the master maps are created, you can start the NIS daemons on the master server and begin service. To do this, you have to start ypserv on the server and run ypbind. When a client requests information from the server, ypserv is the daemon that answers information requests from clients after looking them up in the NIS maps. There are two ways that NIS service can be started on a server: Starting NIS Service AutomaticallyAfter the NIS master server has been configured by running ypinit, ypstart is automatically invoked to start up ypserve when the machine is booted. (See "Setting Up the Master Server With ypinit".) Starting NIS From the Command LineTo begin NIS service from the command line, run the /usr/lib/netsvc/yp/ypstart script:
Note - Because there is a slight delay before ypserv is ready to respond to calls after startup, you should issue a three to five second sleep after ypstart when calling it from inside a program or script. DNS ForwardingIn this Solaris 2.6 release, if the /etc/resolv.conf file is present ypstart will start up ypserve with DNS forwarding. If you do not want the DNS forwarding option set, edit the /usr/lib/netsvc/yp/ypstart script to remove the -d option from the ypserv command. You must then reboot the machine. For more information about using NIS with DNS, refer to Chapter 13, Setting Up DNS Servers and Solaris Naming Administration Guide. Stopping NIS with ypstopTo stop NIS service, run the ypstop command:
Setting Up NIS Slave ServersYour network can have one or more slave servers. Having slave servers ensures the continuity of NIS services when the master server is not available. Preparing a Slave ServerBefore actually running ypinit to create the slave servers, you should run the domainname command on each NIS slave to make sure the domain name is consistent with the master server. Note - Domain names are case-sensitive. Make sure that the network is working properly before you configure an NIS slave server. In particular, check to be sure you can use rcp to send files from the master NIS server to NIS slaves. Setting Up a Slave ServerNow you are ready to create a new slave server, as follows:
Starting NIS Service on a Slave ServerNow you can start daemons on the slave server and begin NIS service. All existing yp processes must be stopped, by typing:
To start ypserv on the slave server and run ypbind, type:
Alternatively, you can reboot the slave server and daemons will be started automatically. Setting Up NIS ClientsYou must perform two tasks to allow a machine to use NIS:
Configuring a Machine to Use NISThe two methods for configuring a machine to use NIS as its name service are explained below.
You will be asked to name NIS servers from which the client may obtain name service 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 a 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.
When you run ypbind, it searches the local subnet for an NIS server. If it finds one, it binds to it. This search is referred to as broadcasting. If there is no NIS server on the client's local subnet, it will fail to bind and the client machine will not be able to obtain namespace data from the NIS service. NIS MapsThe namespace data set used by NIS is stored in a set of NIS maps. NIS maps are essentially two-column tables. Default NIS MapsTable 10-1 describes the default NIS maps, information they contain, and whether the operating system consults the corresponding administrative files when NIS is running. Table 10-1 NIS Map Descriptions
Modifying NIS MapsSee Solaris Naming Administration Guide for information on modifying NIS maps after they are created. NIS Administration, Problem Solving, and Error MessagesSee Solaris Naming Administration Guide for information on NIS administration, problem solving, and error messages. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||