NIS

The NIS, formerly called the Sun Yellow Pages (YP), is a distributed database system that lets the system administrator manage the configuration of many hosts from a central location. Common configuration information, which would have to be maintained separately on each host in a network without NIS, can be stored and maintained in a central location and then propagated to all the nodes in the network. NIS stores information about workstation names and addresses, users, the network itself, and network services. This collection of network information is referred to as the NIS namespace.

Note

As stated, the NIS was formerly known as the Sun Yellow Pages (YP). The functionality of the two remains the same; only the name has changed. The name Yellow Pages is a registered trademark in the United Kingdom of British Telecommunications PLC, and it may not be used without permission.


Before I begin a discussion of the structure of NIS, you need to be aware that the NIS administration databases are called maps. A domain is a collection of systems that share a common set of NIS maps.

Structure of the NIS Network

The systems within an NIS network are configured in the following ways:

  • Master server

  • Slave servers

  • Clients of NIS servers

The center of the NIS network is the NIS master server. The system designated as master server contains the set of maps that you, the NIS administrator, create and update as necessary. After the NIS network is set up, any changes to the maps must be made on the master server. Each NIS domain must have one—and only one—master server. The master server should be a system that can propagate NIS updates with minimal performance degradation.

In addition to the master server, you can create backup servers, called NIS slave servers, to take some of the load off the master server and to substitute for the master server if it goes down. If you create an NIS slave server, the maps on the master server are transferred to the slave server. A slave server has a complete copy of the master set of NIS maps. If a change is made to a map on the master server, the updates are propagated among the slave servers. The existence of slave servers lets the system administrator evenly distribute the load that results from answering NIS requests. It also minimizes the impact of a server becoming unavailable.

Typically, all the hosts in the network, including the master and slave servers, are NIS clients. If a process on an NIS client requests configuration information, it calls NIS instead of looking in its local configuration files. For group and password information and mail aliases, the /etc/files might be consulted first, and then NIS might be consulted if the requested information is not found in the /etc/files.

Any system can be an NIS client, but only systems with disks should be NIS servers, whether master or slave. Servers are also clients of themselves.

As mentioned earlier, the set of maps shared by the servers and clients is called the NIS domain. The master copies of the maps are located on the NIS master server, in the directory /var/yp/<domainname>, in which <domainname> is the chosen name for your own domain. Under the <domainname> directory, each map is stored as two files: mapname.dir and mapname.pag. Each slave server has an identical directory containing the same set of maps.

When a client starts up, it broadcasts a request for a server that serves its domain. Any server that has the set of maps for the client’s domain, whether it’s a master or a slave server, can answer the request. The client “binds” to the first server that answers its request, and that server then answers all its NIS queries.

A host cannot be the master server for more than one NIS domain. However, a master server for one domain might be a slave server for another domain. A host can be a slave server for multiple domains. A client belongs to only one domain.

Determining How Many NIS Servers You Need

The following guidelines can be used to determine how many NIS servers you need in your domain:

  • You should put a server on each subnetwork in your domain. When a client starts up, it broadcasts a message to find the nearest server. Solaris 9 does not require the server to be on the same subnet; however, earlier implementations of NIS historically required that a server exist on every subnet using NIS.

  • In general, a server can serve about 30 NIS clients if the clients and servers run at the same speed. If the clients are faster than the servers, you need more servers. If the clients are slower than the servers, each server can serve 50 or more clients.

Determining Which Hosts Will Be NIS Servers

Determine which systems on your network will be NIS servers as follows:

  • Choose servers that are reliable and highly available.

  • Choose fast servers that are not used for CPU-intensive applications. Do not use gateways or terminal servers as NIS servers.

  • Although it isn’t a requirement, it’s a good idea to distribute servers appropriately among client networks. In other words, each subnet should have enough servers to accommodate the clients on that subnet.

Information Managed by NIS

As discussed, NIS stores information in a set of files called maps. Maps were designed to replace UNIX /etc files, as well as other configuration files.

NIS maps are multicolumn tables. One column is the key, and the other column is the information value related to the key. NIS finds information for a client by searching the keys. Some information is stored in several maps because each map uses a different key. For example, the names and addresses of systems are stored in two maps: hosts.byname and hosts.byaddr. If a server has a system’s name and needs to find its address, it looks in the hosts.byname map. If it has the address and needs to find the name, it looks in the hosts.byaddr map.

Maps for a domain are located in each server’s /var/yp/<domainname> directory. For example, the maps that belong to the domain www.example.com are located in each server’s /var/yp/example.com directory.

An NIS makefile is stored in the /var/yp directory of the NIS server at installation time. If you run the /usr/ccs/bin/make command in that directory, makedbm creates or modifies the default NIS maps from the input files. For example, an input file might be /etc/hosts. By now, you should be familiar with the content of this file. Issue the following command to create the NIS map files:

cd /var/yp 
/usr/ccs/bin/make 

Note

Never make the maps on a slave server. Always run the make command on the master server.


Creating NIS maps is described in more detail in the later section “Configuring an NIS Master Server.”

Solaris provides a default set of NIS maps, described in Table 23.2. You might want to use all or only some of these maps. NIS can also use whatever maps you create or add if you install other software products.

Table 23.2. Default NIS Maps
Map Name Corresponding NIS Admin File Description
bootparams bootparams Contains the pathnames that clients need during startup: root, swap, and possibly others.
ethers.byaddr ethers Contains system names and ethernet addresses. The ethernet address is the key in the map.
ethers.byname ethers Contains system names and ethernet addresses. The system name is the key.
group.bygid group Contains group security information. The GID (group ID) is the key.
group.byname group Contains group security information. The group name is the key.
hosts.byaddr hosts Contains the system name and IP address. The IP address is the key.
hosts.byname hosts Contains the system name and IP address. The system (host) name is the key.
mail.aliases aliases Contains aliases and mail addresses. The alias is the key.
mail.byaddr aliases Contains mail addresses and aliases. The mail address is the key.
netgroup netgroup Contains the group name, username, and system name. The group name is the key.
netgroup.byhost netgroup Contains the group name, username, and system name. The system name is the key.
netgroup.byuser netgroup Contains the group name, username, and system name. The username is the key.
netid.byname passwd Used for UNIX-style hosts and group authentication. It contains the system name and mail address (including domain name). If a netid file is available, it is consulted in addition to the data available through the other files.
netmasks.byaddr netmasks Contains the network masks to be used with IP subnetting. The address is the key.
networks.byaddr networks Contains names of networks known to your system and their IP addresses. The address is the key.
networks.byname networks Contains names of networks known to your system and their IP addresses. The name of the network is the key.
passwd.adjunct .byname passwd and shadow Contains auditing shadow information and the hidden password information for C2 clients.
passwd.byname passwd and shadow Contains password and shadow information. The username is the key.
passwd.byuid passwd and shadow Contains password and shadow information. The user ID is the key.
protocols.byname protocols Contains the network protocols known to your network. The protocol is the key.
protocols.bynumber protocols Contains the network protocols known to your network.The protocol number is the key.
rpc.bynumber rpc Contains the program number and the name of Remote Procedure Calls (RPCs) known to your system. The program number is the key.
services.byname services Lists Internet services known to your network. The key port or protocol is the key.
services.byservice services Lists Internet services known to your network. The service name is the key.
ypservers N/A Lists the NIS servers known to your network. It’s a single-column table with the system name as the key.

The information in these files is put into NIS databases automatically when you create an NIS master server. Other system files can also be managed by NIS if you want to customize your configuration.

NIS makes updating network databases much simpler than with the /etc file system. You no longer have to change the administrative /etc files on every system each time you modify the network environment. For example, if you add a new system to a network running NIS, you only have to update the input file in the master server and run /usr/ccs/bin/make. This process automatically updates the hosts.byname and hosts.byaddr maps. These maps are then transferred to any slave servers and made available to all the domain’s client systems and their programs.

Just as you use the cat command to display the contents of a text file, you can use the ypcat command to display the values in a map. Here is the basic ypcat syntax:

ypcat [-k] <mapname> 

If a map is composed only of keys, as in the case of ypservers, use ypcat –k; otherwise, ypcat prints blank lines.

In this case, mapname is the name of the map you want to examine.

You can use the ypwhich command to determine which server is the master of a particular map:

ypwhich -m <mapname> 

In this case, mapname is the name of the map whose master you want to find. ypwhich responds by displaying the name of the master server.

These and other NIS commands are covered in the following sections.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset