FreeBSD10でlocal caching resolver unbound を試す
FreeBSD10のシステムからBINDが削除され代わりのcaching resolverとしてunboundがシステムに入りました。 portsにあるunboundとは違いlocal_unboundとして存在します。 以前のBINDと違いunboundの設定は非常に簡単です。
自動起動の設定
/etc/rc.conf
local_unbound_enable=yes
サービス起動
$ sudo service local_unbound start
unboundの設定
バインドするインターフェース、ポート、アクセスコントロールの設定を指定します。 ポート番号の指定がなければ53番ポートで待ち受けます。
ここではサーバに付いているNICのアドレスを指定します。
以下の例では192.168.0.10のアドレスとループバックアドレスの53番ポートでサービスを提供します。
またアクセスコントロールとして192.168.0.0/24のネットワークアドレスからのリクエストに応答するようにします。
unbound は簡易なコンテンツサーバにもなりゾーンファイルを使わずにホストとアドレスの名前解決をするように設定できます。 以下の例ではns.example.comのアドレスレコードと逆引きのアドレスを設定します。
自分自身で全ての名前解決を行うときはforward.confの行はコメントして下さい。 名前解決を他のネームサーバに任せる時にはforward.confに他のDNSサーバのアドレスを指定します。
/etc/unbound/unbound.conf
# Generated by local-unbound-setup server: interface: 127.0.0.1 interface: 192.168.0.10 access-control: 192.168.0.0/24 allow username: unbound directory: /var/unbound chroot: /var/unbound pidfile: /var/run/local_unbound.pid auto-trust-anchor-file: /var/unbound/root.key local-data: "ns.example.com. A 192.168.0.10" local-data: "10.0.168.192.in-addr.arpa. PTR ns.example.com." #include: /var/unbound/forward.conf
/etc/resolv.conf
# Generated by resolvconf search example.com #nameserver 192.168.0.10 nameserver 127.0.0.1 options edns0
created: