Monday, January 09, 2012

NIS Server Configuration


Introduction:-
The Network Information Service (NIS) provides a simple network lookup service consisting of databases and processes. It was formerly known as Sun Yellow Pages (YP). The functionality of the two remains the same; only the name has changed. Its purpose is to provide information, that has to be known throughout the network, to all machines on the network. Information likely to be distributed by NIS is:
  • Login names/passwords/home directories (/etc/passwd)
  • Group Information (/etc/group)
  • Hostnames and IP numbers (/etc/hosts)
Per quest:-
  • Configure NIS server IP = 192.168.1.1
  • Configure NIS client IP = 192.168.1.2
  • Configure NIS server Hostname = server.rootuser.in
  • Configure NIS client Hostname = clinet.rootuser.in
  • Firewall must be disabled.
1] Install NIS server required pakage.
[root@server ~]# yum install nfs* portmap* yp* xinetd* make* cach* -y

2] Set NIS domain name.
[root@server ~]# vi /etc/sysconfig/network ( Go to end of line )
NISDOMAIN=mylinux
:wq

3] Crete two new users and apply full permission to home directory.
[root@server ~]# useradd anup
[root@server ~]# passwd anup
[root@server ~]# useradd shubham
[root@server ~]# passwd shubham
[root@server ~]# chmod 777 /home

4] Share home directory using NIS service.
[root@server ~]# vi /etc/exports
/home 192.168.1.0/255.255.255.0(rw,sync)

5] Make changes in Makefile.
[root@server ~]# vi /var/yp/Makefile
Before changes–109 all: passwd group hosts rpc services netid protocols mail \
After changes - 109 all: passwd group hosts netid \
:wq

6] Create database using make command.
[root@server ~]# cd /var/yp
[root@server yp]# make
[root@server yp]# cd

7] Now update this database.
[root@server ~]# /usr/lib/yp/ypinit -m
press <control + d> [ To add NIS server ]
press Y [ Confirm by pressing Y ]

8] Start all the service there should be no error.
[root@server ~]# service nfs start
[root@server ~]# service portmap start
[root@server ~]# service xinetd start
[root@server ~]# service ypserv start
[root@server~]# service yppasswdd start
[root@server ~]# service ypbind start

9] Make this services on after restart.
[root@server ~]# chkconfig nfs on
[root@server ~]# chkconfig portmap on
[root@server ~]# chkconfig xinetd on
[root@server ~]# chkconfig ypserv on
[root@server~]# chkconfig yppasswdd on
[root@server ~]# chkconfig ypbind on

Client Side Configuration:-

1] Check communication with NIS server.
[root@client ~]# ping 192.168.1.1

2] Install two package which required to configure NIS client.
[root@client ~]# yum install yp-tools ypbind

3] Set the NIS domain for client
[root@client ~]# vi /etc/sysconfig/network [ Go to end of line & insert line
NISDOMAIN=mylinux
:wq

4] Run the setup command to authenticate client to use NIS domain.
[root@client ~]# setup ==> Select Authentication configuration ==> Select  [ * ] Use NIS from User Information ==> Now set Domain : mylinux & Server : 192.168.1.1 ==> Click on Ok

5] Configure autofs for automounting home directory of NIS server after every restart.
[root@client ~]# vi /etc/auto.master [Go to end of file]
/home /etc/auto.misc
:wq

6] Now open auto.misc file.
[root@client ~]# vi /etc/auto.misc
anup -rw,soft,intr 192.168.1.1:/home/anup
shubham -rw,soft,intr 192.168.1.1:/home/shubham
:wq

7] Restart autofs and ypbind service.
[root@client ~]# service autofs restart
[root@client ~]# service ypbind restart
[root@client ~]# chkconfig autofs on
[root@client ~]# chkconfig ypbind on

8] Finally reboot the client system and login as user anup or shubham.

Add New NIS User:-

1] Go to NIS server machine & create new user. Once the new user created you then have to update the NIS domain authentication files by executing the make command in the /var/yp directory.
[root@server ~]# useradd haribhau
[root@server ~]# passwd haribhau

[root@server ~]# cd /var/yp
[root@server yp]# make

2] To check whether user's authentication information has updated or not.
[root@server ~]# ypmatch haribhau passwd OR
[root@server ~]# getent passwd haribhau