LAN内の設定が必要であるかないかといわれると人それぞれなのですが、ここではLAN内から指定のドメインが来たらローカルIPアドレスを返すというところまで設定します。逆引きは必要なさそうなのでしません。
named.conf内を一部編集しなおします。
ここまでの設定でbind9を再起動させてきちんと引けるかどうかテストしてみてください。
named.conf内を一部編集しなおします。
// This is the primary configuration file for the BIND DNS server named.named.confを上記のように設定したら、追加したドメインのゾーン情報ファイルを設定します。LAN内の設定なので自分の環境に合わせて書き換えてください。ここでは/etc/bind/db.internalというファイル名にしていますが任意で設定してかまいません。
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
include "/etc/bind/named.conf.options";
view "internal" { //←追加
match-clients { localnet; };
// prime the server with knowledge of the root servers
zone "." {
type hint;
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
zone "localhost" {
type master;
file "/etc/bind/db.local";
};
zone "127.in-addr.arpa" {
type master;
file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
type master;
file "/etc/bind/db.0";
};
zone "255.in-addr.arpa" {
type master;
file "/etc/bind/db.255";
};
// ここから追加
zone "example.com" IN { // example.comの正引きゾーン情報
type master;
file "/etc/bind/db.internal";
};
}; //←Internalのブロック終了(忘れずに!)
include "/etc/bind/named.conf.local";
$TTL 86400
@ IN SOA ns.example.com. root.example.com.(
2006041402 ; Serial
7200 ; Refresh
7200 ; Retry
2419200 ; Expire
86400 ) ; Minimum
IN NS ns.example.com.;ネームサーバー名
IN MX 10 example.com.
ns IN A 192.168.11.xx; (ns.example.com用)
@ IN A 192.168.11.xx; (example.com用)
www IN A 192.168.11.xx; (www.example.com用)
ftp IN A 192.168.11.xx; (ftp.example.com用)
mail IN A 192.168.11.xx; (mail.example.com用)
example.com. IN TXT "v=spf1 a mx ~all"
ここまでの設定でbind9を再起動させてきちんと引けるかどうかテストしてみてください。
# dig example.com @127.0.0.1結果に192.168.11.xxと設定したIPアドレスが返ってきたら成功です。何らかのエラーが出てしまったらファイルをチェックする!
または、
# dig example.com @localhost
# named-checkzone example.com /etc/bind/db.internalこれが出れば成功。
zone example.com/IN: loaded serial 2006041402
OK



