Debian 7.0
Sponsored Link

BINDインストール2013/05/06

 
名前解決を行ってくれる DNS (Domain Name System) サーバーを構築します。 ここではDNSサーバーとして BIND 9 をインストールして設定します。 事前にネットワーク内にいるファイアウォールで、TCP と UDP の 53番ポート宛てを通す設定もしておいてください。
[1] まずは BIND 9 のインストールです。
root@dlp:~#
aptitude -y install bind9 bind9utils dnsutils
[2] BIND 9 の設定です。 以下での設定は、グローバルアドレス[172.16.0.80/29], プライベートアドレス[10.0.0.0/24], ドメイン名[srv.world]と仮定した場合のものですので、自分の環境に合わせて置き換えて設定してください。 (172.16.0.80/29 は実際にはプライベート用のアドレスですが)
root@dlp:~#
vi /etc/bind/named.conf
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
# コメント化

#
include "/etc/bind/named.conf.default-zones";
# 追記

include "/etc/bind/named.conf.internal-zones";
include "/etc/bind/named.conf.external-zones";
root@dlp:~#
vi /etc/bind/named.conf.internal-zones
 
# 新規作成
# 内部向けの定義を記述

view "internal" {
# 指定範囲内のホストが内部向けの定義を参照

        match-clients {
                localhost;
                10.0.0.0/24;
        };
# 内部向け正引き情報を定義

        zone "srv.world" {
                type master;
                file "/etc/bind/srv.world.lan";
                allow-update { none; };
        };
# 内部向け逆引き情報を定義 *注

        zone "0.0.10.in-addr.arpa" {
                type master;
                file "/etc/bind/0.0.10.db";
                allow-update { none; };
        };
        include "/etc/bind/named.conf.default-zones";
};

root@dlp:~#
vi /etc/bind/named.conf.external-zones
 
# 新規作成
# 外部向けの定義を記述

view "external" {
# 内部向け範囲以外のホストが参照

        match-clients { any; };
# 問い合わせは全て許可

        allow-query { any; };
# 再帰検索禁止

        recursion no;
# 外部向け正引き情報を定義

        zone "srv.world" {
                type master;
                file "/etc/bind/srv.world.wan";
                allow-update { none; };
        };
# 外部向け正引き情報を定義 *注

        zone "80.0.16.172.in-addr.arpa" {
                type master;
                file "/etc/bind/80.0.16.172.db";
                allow-update { none; };
        };
};

# *注:「*.*.*.*.in-addr.arpa」と指定するところはネットワークアドレスを逆にしたものを入力
10.0.0.0/24 の場合
ネットワークアドレス
⇒ 10.0.0.0

ネットワークの範囲
⇒ 10.0.0.0 - 10.0.0.255

指定方法
⇒ 0.0.10.in-addr.arpa
172.16.0.80/29 の場合
ネットワークアドレス
⇒ 172.16.0.80

ネットワークの範囲
⇒ 172.16.0.80 - 172.16.0.87

指定方法
⇒ 80.0.16.172.in-addr.arpa
[3] 名前解決の問い合わせ等を許可する範囲等を限定しておきます。
root@dlp:~#
vi /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want

// to talk to, you may need to fix the firewall to allow multiple

// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable

// nameservers, you probably want to use them as forwarders.

// Uncomment the following block, and insert the addresses replacing

// the all-0's placeholder.
// forwarders {

//       0.0.0.0;

// };
# 問い合わせを許可する範囲

allow-query { localhost; 10.0.0.0/24; };

# ゾーン情報の転送を許可する範囲 ( セカンダリDNSがいる場合は、その場所/範囲 )

allow-transfer { localhost; 10.0.0.0/24; };

# 再帰検索を許可する範囲

allow-recursion { localhost; 10.0.0.0/24; };
dnssec-validation auto;

auth-nxdomain no; # conform to RFC1035

# IPV6を使っていなければコメント化

#
listen-on-v6 { any; };

};
関連コンテンツ