事前確認事項 †インストール †aptitude install dnsutils bind9 bind9-doc dnsutils rndc マニュアル †bind9-docを入れると /usr/share/doc/bind9-doc/arm以下にBv9ARM.html にあるのでwebページとして表示させるようにApache2の設定に追加する 設定の種類 
 順引き 
 構成としては 
 設定箇所 †自宅サーバでの設定方法 †通常の設定方法 †/etc/bind$ sudo rndc-confgen -r /dev/random > rndc.conf # Start of rndc.conf
key "rndc-key" {
	algorithm hmac-md5;
	secret "ごにょごにょ=";
};
options {
	default-key "rndc-key";
	default-server 127.0.0.1;
	default-port 953;
};
# End of rndc.conf
# Use with the following in named.conf, adjusting the allow list as needed:
# key "rndc-key" {
# 	algorithm hmac-md5;
# 	secret "ごにょごにょ=";
# };
# 
#  controls {
# 	inet 127.0.0.1 port 953
# 		allow { 127.0.0.1; } keys { "rndc-key"; };
# };
# End of named.conf
chown bind:bind rndc.conf /etc/bind/named.conf .... /etc/bind/named.conf.options options {
...
    version "DNS Server" #追加する
    recursion yes; #キャッシュサーバの場合 yes
    allow-transfer { none; }; #zoneの転送はしない(BIND9のdefaultは制限がかかってない)
}
/etc/bind/named.conf.local # Use with the following in named.conf, adjusting the allow list as needed:
key "rndc-key" {
 	algorithm hmac-md5;
 	secret "axdGqNFdPQWWuNQ6jrBnww==";
 };
 
  controls {
 	inet 127.0.0.1 port 953
 		allow { 127.0.0.1; } keys { "rndc-key"; };
 };
# End of named.conf
#zone情報を追加する
zone "example.jp" {
      type master;
      file "/etc/bind/db.example.jp";
       allow-query { any; }
};
/etc/bind/db.example.jp 設定を元に戻す方法 †rndc-confgen > /etc/bind/rndc.conf とすると key "rndc-key" {
        algorithm hmac-md5;
	 secret "ごにょごにょしたの";
};
options {
        default-key "rndc-key";
        default-server 127.0.0.1;
        default-port 953;
};
といった物が出来る。 キャッシュのみのネームサーバーにする方法 †LAN内や社内などのみに使われる場合など。外部からの要求には拒否をする。 acl "corpnets" { 
 192.168.4.0/24;  //社内とかのIP
 192.168.7.0/24;  //上記に同じ
};
options {
     directory "/var/cache/bind";           // Working directory
     pid-file "named.pid";              // Put pid file in working dir
     allow-query { "corpnets"; };
};
// ルートサーバーのヒント
zone "." { 
 type hint; 
 file "root.hint"; 
};
// 127.0.0.1のループバック際の情報をあげる
zone "0.0.127.in-addr.arpa" {
     type master;
     file "localhost.rev";
     notify no;
};
rndcで管理する方法 †まずはrndcを起動する /usr/sbin/rndc *restart rndcのオプション 
 rndcを使う為には設定をしないと行けない。具体的には/etc/bind/rndc.keyに下記のような行が必要(ローカルからの接続)。 controls {
       inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "comuro"; };
};
セキュリティ対策 †bind9で使えるセキュリティ対策はこちら! 確認方法 †設定ファイルをチェックしてくれるコマンド -v : named-checkconfのバージョンを表示 エラー時には †MacでDNSキャッシュをクリアしたい場合は dscacheutil -flushcache 参考URL †Bind = Berkeley Internet Name Domainの略らしい。Book binderとかをイメージしてた。  |