3.2. BIND の設定
1./etc/rndc.key に書き込みます。
# rndc-confgen -a
2. 以下の before オプションを追加します。
# sed -i '/^options.*/i \
include "/etc/rndc.key"; \
controls { \
inet 127.0.0.1 allow { localhost; } keys { "rndc-key"; }; \
};' /etc/named.conf
3.後で書き換える既存のオプションを削除します。
# sed -i '/allow-query.*/d' /etc/named.conf
# sed -i '/recursion.*/d' /etc/named.conf
4.オプション の後に以下を追加します。
# sed -i '/^options.*/a \
allow-new-zones yes; \
allow-query { any; }; \
recursion no;' /etc/named.conf
5.rndc 設定を作成します。コンピュートノードの場合、rndc 設定は DNS サーバーを参照する必要があります。以下に例を示します。
# cat << EOF > /etc/rndc.conf
include "/etc/rndc.key";
options {
default-key "rndc-key";
default-server 192.168.100.20;
default-port 953;
};
EOF
6.named 設定を確認します。
# named-checkconf /etc/named.conf
7. ファイルの権限を修正します。
# setsebool -P named_write_master_zones on
# chmod g+w /var/named
# chown named:named /etc/rndc.conf
# chown named:named /etc/rndc.key
# chmod 600 /etc/rndc.key
8. named サービスを有効にして起動します。
# systemctl enable named
# systemctl start named
9.名前付き および rndc を検証します。
# dig @localhost localhost
# rndc status