Debian 11 Bullseye
Sponsored Link

NIS : セカンダリーサーバーの設定2021/09/06

 
NIS セカンダリーサーバーを構築し、NIS プライマリーサーバーダウン時も NIS クライアントに対してサービスを継続できるようにします。
+----------------------+          |          +----------------------+
| [    NIS Primary   ] |10.0.0.30 | 10.0.0.31| [    NIS Client    ] |
|     dlp.srv.world    +----------+----------+     www.srv.world    |
|                      |          |          |                      |
+----------------------+          |          +----------------------+
+----------------------+          |
| [   NIS Secondary  ] |10.0.0.51 |
|   node01.srv.world   +----------+
|                      |
+----------------------+

[1]
[2] NIS セカンダリーサーバーとするホストの設定です。
root@node01:~#
vi /etc/default/nis
# 11行目 : 変更 (NIS セカンダリーとする)

NISSERVER=
slave
root@node01:~#
vi /etc/ypserv.securenets
# This line gives access to everybody. PLEASE ADJUST!
# コメントにする

#0.0.0.0                0.0.0.0
#::/0

# 最終行 : アクセス許可する範囲追記
255.255.255.0   10.0.0.0

root@node01:~#
systemctl restart ypserv

root@node01:~#
systemctl enable ypserv
# プライマリーサーバーのデータベース同期

root@node01:~#
/usr/lib/yp/ypinit -s dlp.srv.world

We will need a few minutes to copy the data from dlp.srv.world.
Transferring group.bygid...
Trying ypxfrd ... success

.....
.....

At this point, make sure that /etc/passwd and /etc/group have
been edited so that when the NIS is activated, the data bases you
have just created will be used, instead of the /etc ASCII files.
[3] NIS プライマリーサーバーで、新たに構築した NIS セカンダリーサーバー用の設定をします。
root@dlp:~#
vi /var/yp/Makefile
# 23行目 : 変更

NOPUSH=
false
# NIS データベース更新

root@dlp:~#
/usr/lib/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers.  dlp.srv.world is in the list of NIS server hosts.  Please continue to add
the names for the other hosts, one per line.  When you are done with the
list, type a <control D>.
        next host to add:  dlp.srv.world
        next host to add:  node01.srv.world   # NIS セカンダリーを指定
        next host to add:                     # Ctrl + D キー
The current list of NIS servers looks like this:

dlp.srv.world
node01.srv.world

Is this correct?  [y/n: y] y

.....
.....

dlp.srv.world has been set up as a NIS master server.

Now you can run ypinit -s dlp.srv.world on all slave server.
[4] NIS クライアントがセカンダリーサーバーも参照できるよう設定します。 以上により、プライマリーサーバーダウン時も、参照先がセカンダリーサーバーに自動で切り替わり、NIS サービスは継続されるようになります。
root@client:~#
vi /etc/yp.conf
# 最終行にセカンダリーサーバーを追記

domain srv.world server dlp.srv.world
domain srv.world server node01.srv.world
root@client:~#
systemctl restart nis
関連コンテンツ