BIND9インストール(FreeBSD)

概要

FreeBSD6.2にBIND9をインストールする。なお、chrootはしない。

インストール

portsで。

 cd /usr/ports/dns/bind9
 make install

rndcの設定

BIND9の起動などはrndcコマンドを用いる。

鍵の作成

 rndc-confgen -a
 chown bind /etc/namedb/rndc.key

rndc.keyが出来たが、DNSサーバはユーザbindで実行する予定なので、オーナーを変更しておく。

rndc.confの編集 (/etc/namedb/rndc.conf)

 options {        
        default-server  localhost;
        default-key     "key";
 };
 
 server localhost {
        key     "key";
 };
 
 key "key" {
        algorithm       hmac-md5;
        secret          "ABCDEFG12345;
 };

↑「key "key" {}」の部分はrndc.keyのそれをそのままコピーする。

namedの設定

named.confの編集(/var/named/etc/namedb/named.conf)

 options {
        directory       "/etc/namedb";
        pid-file        "/var/run/named/pid";
        dump-file       "/var/dump/named_dump.db";
        statistics-file "/var/stats/named.stats";
 
        forwarders {
                192.168.0.100;
        };
 };
 
 include "rndc.key";
 
 zone "." {
        type hint;
        file "named.root";
 };
 
 zone "0.0.127.IN-ADDR.ARPA" {
        type master;
        file "master/localhost.rev";
 };
 
 zone "example.net" {
        type master;
        file "master/example.net.zone";
 };

example.netゾーン(/var/named/etc/namedb/master/example.net.zone)

 $TTL 86400
 @               IN SOA  ns.example.room. root.ns.example.room (
                                 2007071500              ; serial
                                      10800              ; refresh
                                       3600              ; retry
                                     604800              ; expiry
                                      86400 )            ; minimum
 
                         IN NS           ns.example.room.
                         IN MX   10      mail.example.room.
 ns                      IN A            192.168.1.10
 www                     IN A            192.168.1.20
 mail                    IN A            192.168.1.30

127.0.0.1 ゾーン(/var/named/etc/namedb/master/localhost.rev)

 $TTL    604800
 @       IN      SOA     localhost. root.localhost. (
                               1         ; Serial
                          604800         ; Refresh
                           86400         ; Retry
                         2419200         ; Expire
                          604800 )       ; Negative Cache TTL
 ;
 @       IN      NS      localhost.
 1.0.0   IN      PTR     localhost.

起動

 named -u bind -c /etc/namedb/named.conf

自動起動

/etc/rc.confを以下のようにする。

 named_enable="YES"
 named_program="/usr/sbin/named"
 named_flags="-u bind -c /etc/namedb/named.conf"
 named_uid="bind" 
 named_chrootdir=""
 named_chroot_autoupdate="NO"
 named_symlink_enable="NO"

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS

Last-modified: 2007-07-16 (月) 01:23:57