DNS cache サーバ unbound を動かす

CentOS-4 で、DNS cache サーバとして unbound を動かしたのでメモ。

  • 127.0.0.1 のみ Listen して純粋にキャッシュサーバとして使う
  • (外向けのアドレスでは、すでに bind がコンテンツサーバとして動いてるので)

日本 unbound ユーザ会のページから、http://unbound.jp/?page_id=126 SRPMS をダウンロードして rebuld && install.

 $ wget http://unbound.jp/files/rpm/SRPMS/unbound-1.1.1-1.src.rpm
 $ rpmbuild --rebuild unbound-1.1.1-1.src.rpm
 # rpm -Uvh rpm/RPMS/i386/unbound-1.1.1-1.i386.rpm

/etc/unbound.conf

server:
        verbosity: 1
        interface: 127.0.0.1
        access-control: 127.0.0.0/8 allow
        do-ip6: no

do-ip6: no は、このネットワークでは現状 IPV6 が使えないため。エラーログに名前解決のたびに以下のように出力されてしまう。

Dec 22 17:32:29 hostname unbound: [29528:0] notice: sendto failed: Network is unreachable
Dec 22 17:32:29 hostname unbound: [29528:0] notice: remote address is 2001:502:d399::245 port 53
Dec 22 17:32:29 hostname unbound: [29528:0] notice: error sending query to auth server; skip this address
Dec 22 17:32:29 hostname unbound: [29528:0] notice: error for address: 2001:502:d399::245 port 53

あと、起動スクリプト /etc/init.d/unbound の stop() が、CentOS-4 だと動かない。killproc() が -p オプションを受け付けてくれないため。CentOS-5 なら大丈夫そう。

--- /etc/init.d/unbound.orig    2008-12-22 17:47:28.000000000 +0900
+++ /etc/init.d/unbound 2008-12-22 17:47:36.000000000 +0900
@@ -71,7 +71,7 @@
 stop() {
     echo -n $"Stopping $prog: "
     # stop it here, often "killproc $prog"
-    killproc -p $pidfile $prog
+    killproc $prog
     retval=$?
     echo
     [ $retval -eq 0 ] && rm -f $lockfile