centos5.2 に bind9 を構築する。投稿するほどのものではない。

  1. 前提

global ip address を ドメイン名に変換するいわゆる外部向けDNS

  1. インストール
# yum install bind bind-chroot caching-nameserver

caching-nameserver 入れるとめんどくさい設定ファイル群最初に作ってくれるから便利。
信用ならぬという人は不要。ipv6関連の設定も紛れ込む。本質的に外部向けなら不要です。

  1. 設定

chroot入れてるので、/var/named/chroot/ 以下が本体。
cachong-nameserverの設定をぱくる。

# cp /var/named/chroot/etc/named.caching-nameserver.conf /var/named/chroot/etc/named.conf

書き直す

# diff named.conf named.caching-nameserver.conf 
16c16
<       //listen-on-v6 port 53 { ::1; };
    • -
> listen-on-v6 port 53 { ::1; }; 28,30d27 < recursion no; < version "unknown"; < allow-transfer { none; }; 38,47c35,39 < < zone "." { < type hint; < file "/dev/null"; < }; < < zone "sample.example.japan" { < type master; < file "sample.example.japan.zone"; < allow-transfer { none; };
    • -
> view localhost_resolver { > match-clients { localhost; }; > match-destinations { localhost; }; > recursion yes; > include "/etc/named.rfc1912.zones"; 49d40 <

zoneファイルは自分で書きましょう。
named.confの権限はnamedさんにしとく。

chown named:named /var/named/chroot/etc/named.conf
  1. 起動
# /etc/init.d/named start

/var/log/message で異常がないか見る。

おわり。