CentOS 6
Sponsored Link

NISサーバーの設定2015/03/08

 
各サーバー間でユーザーのアカウント情報を共有できるようにNISサーバーを構築します。
[1] Ypserv をインストールして設定します。
[root@dlp ~]#
yum -y install ypserv rpcbind
# NISドメイン設定

[root@dlp ~]#
ypdomainname srv.world

[root@dlp ~]#
echo 'NISDOMAIN=srv.world' >> /etc/sysconfig/network

[root@dlp ~]#
vi /var/yp/Makefile
# MERGE_PASSWD=true|false
# 42行目:変更

MERGE_PASSWD=
false
# MERGE_GROUP=true|false
# 46行目:変更

MERGE_GROUP=
false
# 117行目:追記

all: passwd
shadow
 group hosts rpc services netid protocols
[root@dlp ~]#
vi /var/yp/securenets
# 新規作成 (アクセス許可するネットワーク)

255.0.0.0       127.0.0.0
255.255.255.0   10.0.0.0

[root@dlp ~]#
vi /etc/hosts
# NISデータベース登録用に自身のIPを登録

10.0.0.30   dlp.srv.world dlp

[root@dlp ~]#
/etc/rc.d/init.d/rpcbind start

Starting portmap:     [  OK  ]
[root@dlp ~]#
/etc/rc.d/init.d/ypserv start

Starting YP server services:     [  OK  ]
[root@dlp ~]#
/etc/rc.d/init.d/ypxfrd start

Starting YP server services:     [  OK  ]
[root@dlp ~]#
/etc/rc.d/init.d/yppasswdd start

Starting YP passwd service:     [  OK  ]
[root@dlp ~]#
chkconfig rpcbind on

[root@dlp ~]#
chkconfig ypserv on

[root@dlp ~]#
chkconfig ypxfrd on

[root@dlp ~]#
chkconfig yppasswdd on
# NISデータベース更新

[root@dlp ~]#
/usr/lib64/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS servers. dlp 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
    next host to add:    
# Ctrl + D キーを押す

The current list of NIS servers looks like this:
dlp
Is this correct? [y/n: y]
y
   
# y キーを押してEnter

We need a few minutes to build the databases...
Building /var/yp/srv.world/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/srv.world'
Updating passwd.byname...
Updating passwd.byuid...
Updating shadow.byname...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/srv.world'
dlp has been set up as a NIS master server.
Now you can run ypinit -s dlp on all slave server.
[2] NIS サーバーにローカルユーザーを新規登録した場合は、以下のようにして NISデータベースへ反映します。
[root@dlp ~]#
cd /var/yp

[root@dlp yp]#
[3] IPTables を有効にしている場合は、NIS関連サービスの許可が必要です。一部の NIS 関連サービスのポートはサービスが起動する度に変動するため、任意のポートに固定する設定をした後に許可設定します。
「-I INPUT *」の箇所は自身の環境を確認して、適切な値に置き換えてください。
[root@dlp ~]#
vi /etc/sysconfig/network
# 最終行に追記

YPSERV_ARGS="-p 944"
YPXFRD_ARGS="-p 945"
[root@dlp ~]#
vi /etc/sysconfig/yppasswdd
# 該当行に追記

YPPASSWDD_ARGS="
--port 946
"
[root@dlp ~]#
for service in rpcbind ypserv ypxfrd yppasswdd
do
    /etc/rc.d/init.d/$service restart
done
[root@dlp ~]#
iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 111 -j ACCEPT

[root@dlp ~]#
iptables -I INPUT 6 -p udp -m state --state NEW -m udp --dport 111 -j ACCEPT

[root@dlp ~]#
iptables -I INPUT 7 -p tcp -m state --state NEW -m tcp --dport 944 -j ACCEPT

[root@dlp ~]#
iptables -I INPUT 8 -p udp -m state --state NEW -m udp --dport 944 -j ACCEPT

[root@dlp ~]#
iptables -I INPUT 9 -p tcp -m state --state NEW -m tcp --dport 945 -j ACCEPT

[root@dlp ~]#
iptables -I INPUT 10 -p udp -m state --state NEW -m udp --dport 945 -j ACCEPT

[root@dlp ~]#
iptables -I INPUT 11 -p udp -m state --state NEW -m udp --dport 946 -j ACCEPT

関連コンテンツ