The following describes a procedure to set up NIS network name service under Red Hat Linux. This is geared toward a small intallation with only one domain. However, it should be fairly evident how to add more NIS domains. The NIS domain name has nothing to do with any DNS naming convention being used.
In these examples, the following conventions are used:
NIS domain: "internal"
Code or configuration file data: colored
Root prompt on NIS master server: master#
Root prompt on NIS client host: client#
Setting up a NIS master server:
Required packages: yp-tools ypbind ypserv portmapSet up "time" service to run via inetd/xinetd, or configure xntpd, or otherwise make sure the host's clock is synchronized.
Edit /etc/yp.conf:
domain internal server ip.of.nis.server
Edit /etc/ypserv.conf:dns: no files: 30 xfr_check_port: yes * : * : shadow.byname : port * : * : passwd.adjunct.byname : portEdit /etc/sysconfig/network:
NISDOMAIN="internal"Set NIS domain name:
master# domainname internal master# ypdomainname internalCreate file /var/yp/securenets:
host 127.0.0.1 255.255.255.0 10.0.0.0Make sure the "portmap" service is running:
master# service portmap start master# chkconfig portmap onPortmap will need a rule in /etc/hosts.allow to allow access from localhost and any hosts that need to access NIS.
Start ypserv service:
master# service ypserv startCheck that it's listening:
master# rpcinfo -u localhost ypservYou should see:
program 100004 version 1 ready and waiting program 100004 version 2 ready and waitingInitialize the NIS maps:
master# /usr/lib/yp/ypinit -mSpecify local hostname, Ctrl-D, y, let finish.
Start up ypbind, yppasswdd, ypxfrd:
master# service ypbind start master# service yppasswdd start master# service ypxfrd startSet YP services to run on boot-up:
master# chkconfig ypserv on master# chkconfig ypbind on master# chkconfig yppasswdd on master# chkconfig ypxfrd on
NIS client host setup
Required packages: yp-tools ypbind portmapEdit /etc/sysconfig/network:
NISDOMAIN=internalEdit /etc/yp.conf:
domain internal server ip.of.master.serverEdit /etc/hosts:
ip.of.master.server hostname.domain hostnameSet NIS domain-name:
client# domainname internal client# ypdomainname internalEdit /etc/nsswitch.conf:
passwd: files nis shadow: files nis group: files nisMake sure the portmap service is running:
client# service portmap start client# chkconfig portmap onThe /etc/hosts.allow file will need rules allowing access from localhost and the NIS master server.
Start ypbind service:
client# service ypbind start client# chkconfig ypbind onTest it out:
client# rpcinfo -u localhost ypbind client# ypcat passwd