Minicluster:NIS

De WikiLICC
Revisão de 22h32min de 8 de julho de 2010 por Dago (Discussão | contribs) (Setting up a NIS master server)
Ir para: navegação, pesquisa

Servidor NIS

  • Instale o servidor NIS
[root@one]$ yum install ypserv
[root@one]$ chkconfig --level 345 ypserv on
[root@one]$ nisdomainname nismatrix 
[root@one]$ nisdomainname
nismatrix
[root@one]$ /etc/init.d/ypserv start
Starting YP server services:             [  OK  ]
[root@one]$ rpcinfo -u one ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting
  • Editar linhas em
[root@one]$ vi /var/yp/Makefile
..
ALIASES     = $(YPSRCDIR)/aliases  # aliases could be in /etc or /etc/mail
#ALIASES    = /etc/mail/aliases
..
  • Gerar o banco de dados no servidor
[root@one]$ /usr/lib64/yp/ypinit -m

Cliente NIS

[root@cell100]$ chkconfig --level 345 ypbind on
nisdomainname nismatrix                                        
[root@cell100] ~ # nisdomainname


config

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 portmap

Set up "time" service to run via inetd/xinetd, or configure xntpd, or otherwise make sure the host's clock is synchronized.

  • Edite /etc/yp.conf:
domain internal server ip.of.nis.server
domain nismatrix server 192.168.0.99

Edite /etc/ypserv.conf:

..
dns: no
files: 30
xfr_check_port: yes
* : * : shadow.byname : port
* : * : passwd.adjunct.byname : port 

Edite /etc/sysconfig/network:

NISDOMAIN="nismatrix"

Setar NIS domain name:

one# domainname nismatrix
one# ypdomainname nismatrix

Create file /var/yp/securenets:

host 127.0.0.1
255.255.255.0   10.0.0.0

Make sure the "portmap" service is running:

master# service portmap start
master# chkconfig portmap on

Portmap will need a rule in /etc/hosts.allow to allow access from localhost and any hosts that need to access NIS.

Inicie o serviço ypserv:

one# service ypserv start

Verifique se está escutando

one# rpcinfo -u localhost ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting

Inicialize o mapeamento NIS:

one# /usr/lib64/yp/ypinit -m

Especifique one.matrix, Ctrl-D, y, e deixe finalizar.

Inicie ypbind, yppasswdd, ypxfrd:

one# service ypbind start
one# service yppasswdd start
one# service ypxfrd start

Set YP services to run on boot-up:

one# chkconfig ypserv on
one# chkconfig ypbind on
one# chkconfig yppasswdd on
one# chkconfig ypxfrd on

NIS client host setup

Required packages: yp-tools ypbind portmap

Edit /etc/sysconfig/network:

NISDOMAIN=internal

Edit /etc/yp.conf:

domain internal server ip.of.master.server

Edit /etc/hosts:

ip.of.master.server    hostname.domain hostname

Set NIS domain-name:

client# domainname internal
client# ypdomainname internal

Edit /etc/nsswitch.conf:

passwd:     files nis
shadow:     files nis
group:      files nis

Make sure the portmap service is running:

client# service portmap start
client# chkconfig portmap on

The /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 on

Test it out:

client# rpcinfo -u localhost ypbind
client# ypcat passwd

Referências