Tuesday, November 22, 2011

NFS ( Network File System) and NIS( Network Information Service)

NFS:-
NFS server is used for file sharing and directory sharing between linux to linux machine

Service Profile
Type                        :    System V-managed
Package                   :    nfs-utils
Daemon                   :    rpc.rquotad, rpc.statd.nfsd
Script                        :    nfs
Port                           :    2048
Configuration File    :    /etc/exports

Check the rpm
# rpm –q nfs-utils

 Server Setting :-

First make the folder which you want to share
#mkdir /share
#cd /share
#touch a d f
#chmod o+w a b
Now open the configuration file
#vi /etc/exports
Make the following entry

/share 172.24.0.0/255.255.0.0(rw,sync)

Save and exit

/share will be shared by the entire network

Start the service
#service portmap restart
#chkconfig portmap on
#service nfs restart
#chkconfig nfs on
Note:
We need to restart the service portmap before nfs service in order to assign port number.
To check
#showmount –e 172.24.254.254
#showmount –e server1

Client :-

Mount the /share directory on client machine
#mount –t nfs:172.24.254.254:/share /mnt
Where /mnt is a mount point

For sharing particular IP address
Server:
#vi /etc/exports
/share 172.24.0.3/255.255.0.0(rw,sync)
/share 172.24.0.4/255.255.0.0(rw,sync)

For two different network
#vi /etc/exports
/share 172.24.0.0/255.255.0.0(rw,sync)
/share 172.25.0.0/255.255.0.0(rw,sync)

For all world
#vi /etc/exports
/share *(rw,sync)
If we give a space between the network and (rw,sync), then it will mount for everyone
#vi /etc/exports
/share 172.24.0.0/255.255.0.0  (rw,sync)
If we give no permission then it will take (ro,sync)

#export –r
#export –a
#export –ar
If we run this command then there is no need to restart portmap and nfs again and again.

NIS( Network Information Service) :-
 
NIS provide simple directory service for system and account information. NIS server is used to manage the system and account information on multiple system from the central server.

Service Profile
Type            :    system V manage
Package       :    Server:-
                                       Portmap ypserv make   
                         Client :-
                                        Authconfig authconfig-gtk portmap yp-tools ypbind
Daemon        :    rpc.ypserv rpc.yppasswddd
Script            :    ypserv, yppasswdd
Configuration        :    /etc/sysconfig/network
                                    /var/yp/Makefile
Server Setting:
Steps
  1. Check the rpm’s

#rpm –q portmap ypserv make

  1. Edit the file

#vi /etc/sysconfig/network
Define the following line
NISDOMAIN=ICON
Save and exit

  1. Edit the file

#vi /var/yp/Makefile
Search for “/all: “ line
Remove all the entry except
all: passwd group hosts netid
save and exit

  1. Start the service
#service portmap restart
#chkconfig portmap on
#service ypserv restart
#chkconfig ypserv on

  1. Now create a database for NIS server
# /usr/lib/yp/ypinit –m
            -m : Master

  1. Now create a user with home directory /rhome/nisuserX
#mkdir /rhome
#adduser –d /rhome/nisuser1 nisuser1
#passwd nisuser1

  1. Make the entry of the home directory of user in /etc/exports file
#vi /etc/exports

/rhome/nisuser1       172.24.0.0/255.255.0.0(rw,sync)

Save and exit

  1. start the service
#service portmap restart
#chkconfig portmap on
#service nfs restart
#chkconfig nfs on
#service yppasswdd restart
#chkconfig yppasswdd on

  1. Finally Update the database
#cd /var/yp
#make


Client Setting:
  1. Check the rpm’s

#rpm –q portmap authconfig authconfig-gtk yp-tools ypbind

  1. Run the command
#authconfig
Or
#system-config-authentication

In this enable and write the following option
“Enable NIS option” and Press F12
In NIS Setting
Domain           :           ICON
Server             :           172.24.254.254
  1. Edit Two File “auto.master” and “auto.misc”

#vi /etc/auto.master

/rhome                       /etc/auto.misc  --timeout=60
This file define the path of the home directory

#vi /etc/auto.misc

Nisuser1         -rw,soft,intr    172.24.254.254:/rhome/nisuser1
Save and exit

  1. Start the service
#service autofs restart
#chkconfig autofs on

  1. Run the following command to check the password
#ypcat passwd
#getent passwd
ypcat will display the entry of server user information
getent will display the entry of local and server user information

  1. Finally login with user as “nisuser1” and passwd

 
Thanks,

No comments:

Post a Comment