Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Linux Answers > Networking
User Name


By vimal at 2006-01-17 09:34
Network Information Service

'Network Information Service' or NIS was created by SUN MicroSystems for the easy administration of users and for account management. It was named as 'Yellow Pages' but due to a patent by the 'British Telecomm Department', they had to change it to NIS. We can see the relationship to their former name, since most of the commands start with 'yp'.
NIS help the system administrators by setting up a centralised environment for user and accounts management. All the user accounts stay on the NIS master server and can be managed centrally. The scenario for NIS consists of a central master NIS server and one or more secondary servers. The existence of secondary or slave servers, are ofcourse, for redundancy.
The theory of NIS relies on the concept of mounting user's home directories (which reside on the master NIS server) on to the client machines on request. For this, AutoFS and NFS are used. The user's home directories are exported on the network via NFS. AutoFS is used so as to mount home directories on to the client machines upon logging from the user part.
NIS uses RPC or 'Remote Procedure Calls' to establish connections between server and client. Examples for daemons that use RPC are NFS and NIS. For the efficient working of programs using RPC, portmap is used. The portmap daemon maps the RPC services onto the respective port numbers.When an RPC server starts up, it registers with the portmap daemon. The server tells the daemon which por
t number it is listening to and which RPC program numbers it serves. Thus, the portmap daemon knows the location of every registered port on the host and which programs are available on each of these ports.

Both the server and clients are to be the members of an NIS domain. We can set the common NIS domain name by editing the file '/etc/sysconfig/network' and adding the directive "NISD
OMAIN=<domainname>. Also issue the command 'nisdomainname <domainname>, from the command prompt. This applies for both the server and client.

Server Configuration:
The packages needed for NIS server are;

1) ypserv
2) nfs-utils
3) portmap
4) yppasswd
5) ypxfrd

Install the packages. the installation of the packages depend on your distribution. Or you can use the 'Yellow Dog Updater-Modified' (YUM). Just issue the command 'yum install ypserv'. Yum automatically finds the dependencies and installs them. 'ypserv' contains the packages 'yppasswd' and 'ypxfrd'. Export the home directories from the server using NFS. Restart portmap, ypserv and nfs.

Issue the command '/usr/lib/yp/ypinit -m' to set-up the master server. The '-m' switch tells the program to build a master NIS server. The configuration file for NIS server is /etc/ypserv.conf. The Makefile in /var/yp/ contain the specifications for the files that are used to build the database for the server.We can adjust the specifications as required by editing the Makefile. On issuing the command '/usr/lib/yp/ypinit -m', the system presents us with a menu of the files which are to be added to the database andasks for the confirmation. Once its confirmed the program builds the database and prompts us for the addition of slave servers. The most important point to remember at this point is to keep the portmap service up and running. If its not up ,the database build will not be success.

The information of the slave servers which are added at this time are kept in /var/yp/ypservers. Restart the ypserv, portmap and nfs daemons. This completes the configuration of an NIS master server.

Client Configuration:
The packages needed for an NIS client are;

1) ypbind
2) portmap
3) autofs

Install the ypbind,portmap and autofs package in the client machines which are to be a part of the NIS domain. Ensure portmap is running. Edit the /etc/auto.master file and enter the line;
/home /etc/auto.nis --timeout=60

Copy the file /etc/auto.misc to /etc/auto.nis and the following directive.

* -rw,intr,soft IPofNISserver:/home/&

"*" means all users, 'rw' mounts the share in read-write mode in soft mount with interrupt option enabled. This makes the client able to issue an interrupt if the server does not respond after a fixed time. By default the mount is 'hard', which means the client will go on trying indefinitely for the server share even if the server is down. The 'soft' option makes the mount process retaliate after a given duration.Start the autofs daemon and this will mount the server share onto the client machine's home directory.

The client machine must understand the NIS server on the network and so we have to let it know about it. The configuration can be done in any of the underlined methods.

1) Edit /etc/yp.conf and add the domain-name and server-name in the form <domain>space<servername>.
2)Issue the command 'authconfig'. Enter the NIS server name and the NIS domain name.

Restart portmap, ypbind and autofs.

This completes the NIS client configuration.
Try logging in from any of the client machines in the network. A successful login, with the command prompt aptly set, ensures that the NIS server and client are currently working in conjunction.
One of the important problems that make NIS malfunction is the misconfiguration of autofs. Portmap mustbe up and running at all times, unless you wish your NIS to misbehave and fail.

Hope everyone feels this tutorial useful. All are welcome to point out the mistakes or errors they see when going through this. Feel free to comment, this is the first time i am writing one.

Vimal Kumar.A.R


All times are GMT -5. The time now is 03:05 AM.

Main Menu

Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration