NISの設定(HP-UX)
NISの設定
1.NISサーバの設定
2.NISクライアントの設定
3.設定変更

1.NISサーバの設定

 1.1 Makefileの確認
	ドメインを生成するときに使われる /var/yp/Makefile をチェックします。
	このMakefileで NISに流すpasswdやhostsのファイルを指定します。

	--- /var/yp/Makefile ---
	B=
	DIR =/etc
	DOM = `domainname`
	NOPUSH = ""
	ALIASES = /etc/mail/aliases
	YPDIR=/usr/sbin
	YPDBDIR=/var/yp
	YPPUSH=$(YPDIR)/yppush
	MAKEDBM=$(YPDIR)/makedbm
	REVNETGROUP=$(YPDIR)/revnetgroup
	STDETHERS=$(YPDIR)/stdethers
	STDHOSTS=$(YPDIR)/stdhosts
	MKNETID=$(YPDIR)/mknetid
	MKALIAS=$(YPDIR)/mkalias
	#PWFILE=$(DIR)/passwd
	PWFILE=$(YPDBDIR)/nispasswd   #NISに流すpasswdを変更
	 ...
	all: passwd group hosts networks rpc services protocols \
		netgroup  aliases publickey netid vhe_list auto.master 
	 ...

 1.1 NISのドメインを作成
	ypinitコマンドでドメインを作成します。

	# ypinit -m DOM=dds2
	You will be required to answer a few questions to install the Network Information Service.
	All questions will be asked at the beginning of this procedure.

	Do you want this procedure to quit on non-fatal errors? [y/n: n] [RET]
	OK, but please remember to correct anything which fails.
	If you don't, some part of the system (perhaps the NIS itself) won't work.

	At this point, you must construct a list of the hosts which will be
	NIS servers for the "dds2" domain.
	This machine, alpina, is in the list of Network Information Service servers.
	Please provide the hostnames of the slave servers, one per line.
	When you have no more names to add, enter a  or a blank line.

	        next host to add:  alpina
	        next host to add:

	The current list of NIS servers looks like this:

	alpina

	ys this correct?  [y/n: y] [RET]

	There will be no further questions. The remainder of the procedure should take 5 to 10 minutes.
	Building the ypservers database... ypservers build complete.

	Running make in /var/yp:
	updated passwd
	updated group
	updated hosts
	updated networks
	updated rpc
	updated services
	updated protocols
	updated netgroup
	updated aliases
	updated publickey
	updated netid
	updated vhe_list
	updated auto.master

	alpina has been set up as a master Network Information Service server without any errors.

	If there are running slave NIS servers, run yppush(1M) now for any databases
	which have been changed.  If there are no running slaves, run ypinit on
	those hosts which are to be slave servers.

 1.3 namesvrsの編集
	次回からNISサーバとして起動するたの設定を行います。
	
	--- /etc/rc.config.d/namesvrs
	NIS_MASTER_SERVER=1
	NIS_SLAVE_SERVER=0
	NIS_CLIENT=1
	NIS_DOMAIN=dds2
	WAIT_FOR_NIS_SERVER=FALSE
	MAX_NISCHECKS=2
	YPSERV_OPTIONS=""
	YPBIND_OPTIONS="-ypset"
	#YPPASSWDD_OPTIONS="/etc/passwd -m passwd PWFILE=/etc/passwd"
	YPPASSWDD_OPTIONS="/var/yp/nispasswd -m passwd PWFILE=/var/yp/nispasswd"
	KEYSERV_OPTIONS=""
	YPUPDATED_OPTIONS=""
	YPXFRD_OPTIONS=""
	YPSET_ADDR=""
	

2.NISクライアントの設定

2.1 nsswitch.confの編集 NISから取得するサービスを選択します。 --- /etc/nsswitch.conf --- hosts: files[NOTFOUND=continue] nis[NOTFOUND=continue] dns protocols: files services: files networks: files netgroup: files rpc: files 2.2 passwdの編集 /var/yp/nispasswdに以下の行を追加します。 + 2.3 groupの編集 /etc/group に以下の行を追加します。 + 2.4 namesvrsの編集 次回からNISクライアントとして起動するたの設定を行います。 --- /etc/rc.config.d --- NIS_MASTER_SERVER=0 NIS_SLAVE_SERVER=1 NIS_CLIENT=1 NIS_DOMAIN=dds2 WAIT_FOR_NIS_SERVER=TRUE MAX_NISCHECKS=2 YPSERV_OPTIONS="" YPBIND_OPTIONS="-ypset" YPPASSWDD_OPTIONS="/etc/passwd -m passwd PWFILE=/etc/passwd" KEYSERV_OPTIONS="" YPUPDATED_OPTIONS="" YPXFRD_OPTIONS="" YPSET_ADDR="" 2.5 hostsの編集 hostsに NISのマスターサーバとスレーブサーバを追加します。 普通はDNSからサーバ名を引いてくるのですが、何らかのトラブルで DNSからNISサーバ名を引けなくなると、NIS環境も全滅してしまうので hostsに追加することをお勧めします。 --- /etc/hosts --- xxx.xxx.xxx.xxx assam # master nis server yyy.yyy.yyy.yyy krypton # slave nis server zzz.zzz.zzz.zzz dns1 # dns

3.設定変更

3.1 パスワード情報の追加・修正 /var/yp/nispasswd を修正した後 NIS に反映させます。 # cd /var/yp/ # vi nispasswd # make passwd ypcatで修正が反映されたか確認できます。 # ypcat passwd 3.2 hostsの追加・修正 /etc/hosts を修正した後 NIS に反映させます。 # cd /etc # vi hosts # cd /var/yp # make hosts ypcatで修正が反映されたか確認できます。 # ypcat hosts 3.3 NISに流れているサービスを調べる # ypcat -x