DNSキャッシュ,サーバ機能を分離

DNS

DNSサーバのキャッシュ機能を別サーバに分離します(予定).
それに伴い,コンテンツサーバにはnsdを,キャッシュサーバにはunboundを利用します.
なお,DNSコンテンツサーバは外部には公開していません.

unboundのインストールと設定(2022/1/13)

unboundのインストール

unboundをbindとは別の二台にインストールします.drillコマンドも利用したいのでldns-utilsパッケージもインストールします.

dnf -y install unbound ldns-utils

unboundの設定

/etc/unbound/unbound.confの編集

以下の内容で/etc/unbound/unboudn.confファイルを作成します.

server:
interface: 192.168.xxx.xxx
interface: 127.0.0.1
access-control: 192.168.0.0/16 allow
root-hints: "/etc/unbound/root.hints"
stub-zone:
name: "aquarius.mydns.jp"
stub-addr: 192.168.xxx.xxx
stub-addr: 192.168.xxx.xxx
stub-prime: no
stub-first: no
stub-zone:
name: "yo7612.com"
stub-addr: 192.168.xxx.xxx
stub-addr: 192.168.xxx.xxx
stub-prime: no
stub-first: no
stub-zone:
name: "110.168.192.in-addr.arpa."
stub-addr: 192.168.xxx.xxx
stub-addr: 192.168.xxx.xxx
stub-prime: no
stub-first: no
stub-zone:
name: "100.168.192.in-addr.arpa."
stub-addr: 192.168.xxx.xxx
stub-addr: 192.168.xxx.xxx
stub-prime: no
stub-first: no

/etc/unbound/root.hintsの作成

以下のコマンドでhintファイルを作成します.以下のコマンドは一行で実行します.

/usr/bin/dig +noall +answer +add +bufsize=4096 @a.root-servers.net . ns | sort > /etc/unbound/root.hints

unbound_control.keyとunbound_server.keyの作成

以下のコマンドを一回だけ起動してファイルを作成します.

systemctl start unbound-keygen

unbound-checkconfコマンドを実行して,confファイルにエラーがないことを確認します.

unbound-checkconf
unbound-checkconf: no errors in /etc/unbound/unbound.conf

unboundの起動

以下のコマンドを実行しunboundを起動します.

systemctl enable unbound-keygen
systemctl start unbound-keygen

DHCPサーバの設定

DHCPで配布するDNSのアドレスを変更し,実際に配布されることを確認します.

bindの設定変更

bindでキャッシュ機能を停止します./var/named/chroot/etc/named.confで

recursion no;

としbind(named-chroot)を再起動します.

systemctl restart named-chroot

コメント

タイトルとURLをコピーしました