* 安裝bind9
sudo apt-get install bind9
* 安裝測試工具
sudo apt-get install bind9-host dnsutils
* 安裝文件
sudo apt-get install bind9-doc
* 修改三個設定檔
/etc/bind/named.conf.options
// 設定Access Control List, 設定只允許內部網段查詢才需要
acl lan {
127.0.0.1;
192.168.254.1/24;
};
options {
directory "/var/cache/bind";
allow-query { lan; } // 設定只允許內部網段查詢才需要
forwarders {
8.8.8.8;
8.8.4.4;
168.95.192.1;
168.95.1.1
}
};
/etc/bind/named.conf.local
zone "wensfamily.idv.tw" {
type master;
file "/etc/bind/zones/db.wensfamily.idv.tw";
};
zone "254.168.192.in-addr.arpa" {
type master;
notify no;
file "/etc/bind/zones/db.254.168.192.in-addr.arpa";
};
* 建立 /etc/bind/zones 資料夾
sudo mkdir /etc/bind/zones
* 建立 正向DNS解析設定檔
$TTL 604800
@ IN SOA ns.example.com.tw. webmaster.example.com.tw. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
;
@ IN NS ns.wensfamily.idv.tw.
@ IN MX 10 email.wensfamily.idv.tw.
;
IN A 192.168.254.30
ns IN A 192.168.254.30
email IN A 192.168.254.31
www IN CNAME email.wensfamily.idv.tw.
* 建立反向DNS解析設定檔
$TTL 604800
@ IN SOA ns.example.com.tw. webmaster.example.com.tw. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
;
@ IN NS ns.wensfamily.idv.tw.
@ IN MX 10 email.wensfamily.idv.tw.
30 IN PTR ns.wensfamily.idv.tw.
31 IN PTR email.wensfamily.idv.tw.
* 修改 /etc/resolv.conf
search wensfamily.idv.tw
nameserver 192.168.254.30
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 168.95.192.1
nameserver 168.95.1.1
* 啟動 bind9
sudo /etc/init.d/bind9 restart