Misc/内部用DNSサーバー構築 vm-sigel
2017-06-14 (水) 06:49:17 (3140d)
初期設定はUbuntuサーバーインストール時にある程度設定済み 設定ファイルの作成 †/etc/bind/db.root †デフォルトのものを利用 /etc/bind/named.conf †// This is the primary configuration file for the BIND DNS server named.
//
// 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";
// prime the server with knowledge of the root servers
zone "." {
// ルート DNS の情報
type hint;
// ファイル名
file "/etc/bind/db.root";
};
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
// localhost の正引きの設定
zone "localhost" {
// Master DNS Serverであることを示す
type master;
// ファイル名
file "/etc/bind/db.localhost";
};
// localhost の逆引きの設定
zone "0.0.127.in-addr.arpa" {
// Master DNS Serverであることを明示
type master;
// ファイル名
file "/etc/bind/db.0.0.127";
};
// xx.xxx の正引きの設定(内部用ドメイン)
zone "xx.xxx" {
// Master DNS Serverであることを明示
// 内部から *.xx.xxx を引いたときにきちんと見えるよう設定
type master;
// ファイル名
file "/etc/bind/db.xx.xxx";
allow-update{
192.168.1.50;
127.0.0.1;
};
};
// 192.168.1.* の逆引きの設定
zone "1.168.192.in-addr.arpa" {
// Master DNS Serverであることを明示
type master;
// ファイル名
file "/etc/bind/db.1.168.192";
allow-update{
192.168.1.50;
127.0.0.1;
};
};
// yyy.yy の正引きの設定(DDNSドメイン)
zone "yyy.yy" {
// Master DNS Serverであることを明示
// 内部から tldsjp.yyy.yy を引いたときにきちんと見えるよう設定
type master;
// ファイル名
file "/etc/bind/db.yyy.yy";
};
include "/etc/bind/named.conf.local";
/etc/bind/named.conf.options †options {
// zone ファイルの格納場所
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you might need to uncomment the query-source
// directive below. Previous versions of BIND always asked
// questions using port 53, but BIND 8.1 and later use an unprivileged
// port by default.
// query-source address * port 53;
// BIND の利用を許す範囲を指定
allow-query {
// 自分自身( localhost )
127.0.0.1;
// 192.168.1.* ( Subnet 255.255.255.0 )
192.168.1.0/24;
};
// スレーブ DNS のアドレスを記述。内向き DNS の場合は必要ないが一応記載。
allow-transfer {
// 自分自身( localhost )
127.0.0.1;
// 192.168.1.* ( Subnet 255.255.255.0 )
192.168.1.0/24;
};
// 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;
// };
// 自前で名前解決できないとき、まずはプロバイダの DNS へ聞きに行く様にする。
forwarders {
aaa.bbb.ccc.ddd; // プロバイダのプライマリ DNS の IP アドレス
aaa.bbb.ccc.eee; // プロバイダのセカンダリ DNS の IP アドレス
};
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
/etc/bind/named.conf.local †// // Do any local configuration here // // Consider adding the 1918 zones here, if they are not used in your // organization //include "/etc/bind/zones.rfc1918"; コメントだけですが… /etc/bind/db.localhost †$TTL 1D
@ IN SOA xxxxx.xx.net. root.xxxxx.xx.net. (
2006090300 ; シリアル番号
3H
1H
1W
1D )
IN NS xxxxx.xx.net.
localhost. IN A 127.0.0.1
/etc/bind/db.0.0.127 †$TTL 1D
@ IN SOA xxxxx.xx.net. root.xxxxx.xx.net. (
2006090300
3H
1H
1W
1D )
IN NS xxxxx.xx.net.
1 IN PTR localhost.
/etc/bind/db.xx.net(内部用設定ファイル) †$TTL 1D
@ IN SOA xxxxx.xx.net. root.xxxxx.xx.net. (
2006090300
3H
1H
1W
1D )
IN NS xxxxx.xx.net.
IN MX 10 xxxxx.xx.net. ; メールサーバのホスト名を指定
; 10 は優先順位。
router IN A 192.168.1.1
xxxxx IN A 192.168.1.10
xx.net IN A 192.168.1.10
chrono IN A 192.168.1.3
dns IN CNAME sigel
www IN CNAME sigel
smtp IN CNAME sigel
pop IN CNAME sigel
/etc/bind/db.1.168.192 †$TTL 1D
@ IN SOA xxxxx.xx.net. root.xxxxx.xx.net. (
2006090300
3H
1H
1W
1D )
IN NS xxxxx.xx.net.
IN PTR xx.net. ; 解決するドメイン
IN A 255.255.255.0 ; サブネットマスク
1 IN PTR router.xx.net.
10 IN PTR sigel.xx.net.
2 IN PTR chrono.xx.net.
/etc/bind/yyy.yy(DDNSドメイン設定ファイル) †$TTL 1D
@ IN SOA yyyyy.yyy.yy. root.yyyyyy.yyy.yy. (
2006090300
3H
1H
1W
1D )
IN NS yyyyyy.yyy.yy.
yyyyyy IN A 192.168.1.10
その他のファイルの設定 †/etc/hosts †DNS サーバの情報と hosts の情報が不整合を起こさない為に localhost 以外はコメントアウト 今回は 127.0.0.1のエントリーしかなかったのと IPv6 のよくわからないエントリーだけだったのでそのまま /etc/resolv.conf †search xx.net nameserver 127.0.0.1 nameserver プロバイダのDNSサーバー /etc/nsswitch.conf †hostsの行にdnsが含まれていること hosts: files nisplus nis dns /etc/host.conf †order hosts,bind DDNSセットアップ †参考サイト † |