Solaris Naming Administration Guide

NIS Elements

The NIS service is composed of the following elements:

The NIS Domain

An NIS domain is a collection of machines that share a common set of NIS maps. Each domain has a domain name and each machine sharing the common set of maps belongs to that domain. Domain names are case-sensitive.

Any machine can belong to a given domain, as long as there is a server for that domain's maps in the same network. Solaris Release 2 machines do not require the server to be on the same subnet, but earlier implementations of NIS historically have required that a server exist on every subnet using NIS. A NIS client machine obtains its domain name and binds to a NIS server as part of its boot process.

NIS Daemons

NIS service is provided by five daemons as shown in Table 18-1.

Table 18-1 NIS Daemons

Daemon 

Function 

ypserv

Server process 

ypbind

Binding process 

ypxfr

High speed map transfer 

rpc.yppasswdd

NIS password update daemon 

rpc.ypupdated

Modifies other maps such as publickey

NIS Utilities

NIS service is supported by nine utilities as shown in Table 18-2.

Table 18-2 NIS Utilities

Utility 

Function 

makedbm

Creates dbm file for an NIS map

ypcat

Lists data in a map 

ypinit

Builds and installs an NIS database and initializes NIS client's ypservers list.

yppmatch

Finds a specific entry in a map 

yppoll

Gets a map order number from a server 

yppush

Propagates data from NIS master to NIS slave server 

ypset

Sets binding to a particular server 

ypwhich

Lists name of the NIS server and nickname translation table 

ypxfr

Transfers data from master to slave NIS server 

NIS Maps

NIS stores information in a set of files called maps.

NIS maps were designed to replace UNIX /etc files, as well as other configuration files, so they store much more than names and addresses. On a network running NIS, the NIS master server for each NIS domain maintains a set of NIS maps for other machines in the domain to query. NIS slave servers also maintain duplicates of the master server's maps. NIS client machines can obtain name space information from either master or slave servers.

NIS maps are one type of implementation of Solaris databases. (Other types, not necessarily overlapping, are the files generally found in the /etc directory, the DNS resource records (RRs), and NIS+ tables.)

NIS Maps Overview

NIS maps are essentially two-column tables. One column is the key and the other column is information value related to the key. NIS finds information for a client by searching through the keys. Some information is stored in several maps because each map uses a different key. For example, the names and addresses of machines are stored in two maps: hosts.byname and hosts.byaddr. When a server has a machine's name and needs to find its address, it looks in the hosts.byname map. When 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 test.com are located in each server's /var/yp/test.com directory.

An NIS Makefile is stored in the /var/yp directory of machines designated as a NIS server at installation time. Running make in that directory causes makedbm to create or modify the default NIS maps from the input files. (See Solaris Naming Setup and Configuration Guide for a description of using this process to initially set up your NIS name space.)


Note -

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


The information in NIS maps is stored in ndbm format. The ypfiles and ndbm man pages explain the format of the map file.

Default NIS Maps

A default set of NIS maps are provided for you. You may want to use all these maps or only some of them. NIS can also use whatever maps you create or add when you install other software products.

Table 18-3 describes the default NIS maps, information they contain, and whether the software consults the corresponding administrative files when NIS is running.

Table 18-3 NIS Map Descriptions

Map Name 

Corresponding NIS Admin File 

Description 

bootparams

bootparams

Contains path names of files clients need during boot: root, swap, possibly others. 

ethers.byaddr

ethers

Contains machine names and Ethernet addresses. The Ethernet address is the key in the map. 

ethers.byname

ethers

Same as ethers.byaddr, except the key is machine name instead of the Ethernet address.

group.bygid

group

Contains group security information with group ID as key. 

group.byname

group

Contains group security information with group name as key. 

hosts.byaddr

hosts

Contains machine name, and IP address, with IP address as key. 

hosts.byname

hosts

Contains machine name and IP address, with machine (host) name as key. 

mail.aliases

aliases

Contains aliases and mail addresses, with aliases as key. 

mail.byaddr

aliases

Contains mail address and alias, with mail address as key. 

netgroup.byhost

netgroup

Contains group name, user name and machine name. 

netgroup.byuser

netgroup

Same as netgroup.byhost, except that key is user name.

netgroup

netgroup

Same as netgroup.byhost, except that key is group name.

netid.byname

passwd, hosts

group

Used for UNIX-style authentication. Contains machine name and mail address (including domain name). If there is a netid file available it is consulted in addition to the data available through the other files.

netmasks.byaddr

netmasks

Contains network mask to be used with IP submitting, with the address as the key. 

networks.byaddr

networks

Contains names of networks known to your system and their IP addresses, with the address as the key. 

networks.byname

networks

Same as networks.byaddr, except key is name of network.

passwd.adjunct. byname

passwd and shadow

Contains auditing information and the hidden password information for C2 clients. 

passwd.byname

passwd and shadow

Contains password information with user name as key. 

passwd.byuid

passwd and shadow

Same as passwd.byname, except that key is user ID.

protocols.byname

protocols

Contains network protocols known to your network. 

protocols.bynumber

protocols

Same as protocols.byname, except that key is protocol number.

rpc.bynumber

rpc

Contains program number and name of RPCs known to your system. Key is RPC program number. 

services.byname

services

Lists Internet services known to your network. Key is port or protocol. 

services.byservice

services

Lists Internet services known to your network. Key is service name. 

ypservers

N/A 

Lists NIS servers known to your network. 

Using NIS Maps

NIS makes updating network databases much simpler than with the /etc files system. You no longer have to change the administrative /etc files on every machine each time you modify the network environment.

For example, when you add a new machine to a network running NIS, you only have to update the input file in the master server and run make. This automatically updates the hosts.byname and hosts.byaddr maps. These maps are then transferred to any slave servers and are made available to all of the domain's client machines and their programs. When a client machine or application requests a machine name or address, the NIS server refers to the hosts.byname or hosts.byaddr map as appropriate and sends the requested information to the client.

You can use the ypcat command to display the values in a map. The ypcat basic format is:


% ypcat mapname

Where mapname is the name of the map you want to examine or its nickname. If a map is composed only of keys, as in the case of ypservers, use ypcat -k; otherwise, ypcat prints blank lines. The ypcat man page describes more options for ypcat.

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


% ypwhich -m mapname

Where mapname is the name or the nickname of the map whose master you want to find. ypwhich responds by displaying the name of the master server. For complete information, refer to the ypwhich man page.

NIS Map Nicknames

Nicknames are aliases for full map names. To obtain a list of available map nicknames, such as passwd for passwd.byname, type ypcat -x or ypwhich -x.

Nicknames are stored in the /var/yp/nicknames file, which contains a map nickname followed by the fully specified name for the map, separated by a space. This list may be added to or modified. Currently, there is a limit of 500 nicknames.

Summary of NIS-Related Commands

The NIS service includes specialized daemons, system programs, and commands, which are summarized in Table 18-4. Refer to their man pages for details about how to use them.

Table 18-4 NIS Command Summary

Command 

Description 

ypserv

Services NIS clients' requests for information from a NIS map. ypserv is a daemon that runs on NIS servers with a complete set of maps. At least one ypserv daemon must be present on the network for NIS service to function.

ypbind

Provides NIS server binding information to clients. It provides binding by finding a ypserv process that serves maps within the domain of the requesting client. ypbind must run on all servers and clients.

ypinit

Automatically creates maps for an NIS server from the input files. It is also used to construct the initial /var/yp/binding/domain/ypservers file on the clients. Use ypinit to set up the master NIS server and the slave NIS servers for the first time.

make

Updates NIS maps by reading the Makefile (when run in the /var/yp directory). You can use make to update all maps based on the input files or to update individual maps. The ypmake(1M) man page describes the functionality of make for NIS.

makedbm

makedbm takes an input file and converts it into dbm.dir and dbm.pag files--valid dbm files that NIS can use as maps. You can also use makedbm -u to disassemble a map, so that you can see the key-value pairs that comprise it.

ypxfr

Pulls an NIS map from a remote server to the local /var/yp/domain directory, using NIS itself as the transport medium. You can run ypxfr interactively, or periodically from a crontab file. It is also called by ypserv to initiate a transfer.

ypxfrd

Provides map transfers service for ypxfr requests (generally slave servers). It is run only on the master server.

yppush

Copies a new version of an NIS map from the NIS master server to its slaves. You run it on the master NIS server. 

ypset

Tells a ypbind process to bind to a named NIS server. This is not for casual use and its use is discouraged because of security implications. See the ypset(1M) and ypbind(1M) man pages for information about the ypset and ypsetme options to the ypbind process.

yppoll

Tells which version of an NIS map is running on a server that you specify. It also lists the master server for the map. 

ypcat

Displays the contents of an NIS map. 

ypmatch

Prints the value for one or more specified keys in an NIS map. You cannot specify which version of the NIS server map you are seeing. 

ypwhich

Shows which NIS server a client is using at the moment for NIS services, or, if invoked with the -m mapname option, which NIS server is master of each of the maps. If only -m is used, it displays the names of all the maps available and their respective master servers.