Friday, 18 March 2011

NIS Server & Client


NIS SERVER & CLIENT
-------------------

Network information service/system.
-----> synario :
# I want to make 192.168.0.10 as my nisserver(nisdomainname as rhce).
#I have 3 systems in my network(192.168.0.1-192.168.0.3).


Why NIS Server?
----------------
1- authentication.
2- centralisation of data.


STEPS:
-----


Script:
ypserv--> server side for server configuration
yppasswdd--> server side in order to allow  nisusers to change thier password
ypxfrd--> to accelarete data syncronaisation.
ypbind--> client side in order to comunicate with server.


Server Side:
------------
step 1: Install the required packages (ypserv,ypbind,yp-tools,nfs-utils,portmap,autofs)
# yum -y install ypbind ypserv yp-tools nfs-utils portmap autofs


step 2: Assign nisdomainname to server. And make it permanent.


# nisdomainname rhce


To make it permanent 
# vi /etc/sysconfig/network
NISDOMAIN=rhce
    :wq
# service network restart


step 3: Start the service and avail the the service when it boots again.


# service ypserv restart
# service yppasswd restart
# service ypxfrd restart
# chkconfig ypserv on
# chkconfig yppasswd on
# chkconfig ypxfrd on


step 4: Mention what all information u want to map with client.
# vi /var/yp/Makefile
all:  passwd group hosts ### line no:109
# service ypserv restart
step 5: create the data base(maps.dbm) maintained by NIS Server.


# /usr/lib/yp/ypinit -m  ### m for master; 


step 6: start the data base
# service yppasswdd restart
# chkconfig yppasswdd on


step 7: create  3 users(user1-user3) and assign them passwords as password


# useradd user1
# echo "password" | passwd --stdin user1


step 8: update the database because after creting database u had created users
# cd /var/yp
# make




CLIENT SIDE
-----------
step 1: Install the required packeges.
# yum -y install ypbind yp-tools


Check Few Things:
a> nisdomainname
b> cat /etc/sysconfig/network
c> service ypbind status
d> cat /etc/nsswitch.conf
e> cat /etc/yp.conf


step 2: make the system client to nis server.
# authconfig-tui ( strike NIS option then,give nisdomainname i.e. rhce, and server address i.e. 192.168.0.10)
# ypwhich (it should show u whois ur NIS server i.e. station10.example.com)
# ypcat passwd | grep user1 ( it should show u detail authentication info of user1)


** now if a user login as a user1 it will give u bash prompt
# su - user1


** now again run 5 comands given in Check Few Things section and find the difference.


SERVER SIDE
-----------
step 1: Install nfs-utils package.


# yum -y install nfs-utils


step 2: export /home dirctory to 192.168.0.0 network.


# vi /etc/exports
/home *.example.com(rw,sync)
    :wq


reload the service 
# exportfs -rv


step 3: restart nfs service


# service nfs restart
# chkconfig nfs on




CLIENT SIDE
------------


step 1: Install autofs package
yum -y install  autofs


step 2: write it in auto.master auto.misc to make it auto mounted
# vi /etc/auto.master
/home /etc/auto.misc --timeout=60
   :wq


#  vi /etc/auto.misc
* -fstype=nfs 192.168.0.254:/home/&
    :wq


step 3: restart the service 
# service autofs restart

step 4:  Now login
# su - nisuser1
u can login as user1 with password as password.And u will get ur prompt.
### when u create any file it is stord in NIS Server rather in ur local machines.
### whenever u modify the data in database always go inside /var/yp and say ### make.


How To Configure NIS Slave
***************************
Server Side:
------------
I -> vi /var/yp/ypservers
#add slaves address also which will have only masters address
II -> vi /var/yp/Makefile
BY default NOPUSH=YES make it NO ** in order push the updates into slave. 


Slave Side:
----------


step 1: Install the required packages (ypserv,ypbind,yp-tools,nfs-utils,portmap,autofs)
# yum -y install ypbind ypserv yp-tools nfs-utils portmap autofs


step 2: Assign nisdomainname to server. And make it permanent.


# nisdomainname rhce


To make it permanent 
# vi /etc/sysconfig/network
NISDOMAIN=rhce
    :wq
# service network restart


step 3: Start the service and avail the the service when it boots again.


# service ypserv restart
# service yppasswd restart
# service ypxfrd restart
# chkconfig ypserv on
# chkconfig yppasswd on
# chkconfig ypxfrd on


step 4: Mention what all information u want to map with client.
# vi /var/yp/Makefile
all:  passwd group hosts ### line no:109
# service ypserv restart


step 5: create the data base(maps.dbm) maintained by NIS Server.
# /usr/lib/yp/ypinit -s 192.168.0.1  ### -s for slave 192.168.0.1 is master nis; 


Client Side:
-----------


# vi /etc/yp.conf
at bottom u will have a line for master and one more line for slave also.






****now stop service in master and check slave is responding or not. And IT SHOULD **********

No comments:

Post a Comment