先記錄下來,以後有空慢慢補上。
安裝bind9
# sudo apt-get install bind9
會出現
The following extra packages will be installed:
bind9utils libbind9-40 libdns43 libisc44 libisccc40 libisccfg40 liblwres40
Suggested packages:
dnsutils bind9-doc resolvconf
The following NEW packages will be installed:
bind9 bind9utils libbind9-40 libdns43 libisc44 libisccc40 libisccfg40 liblwres40
其中有出現建議安裝的packages: dnsutils bind9-doc resolvconf
安裝測試工具
# sudo apt-get install bind9-host dnsutils
安裝文件
# sudo apt-get install bind9-doc
設定檔:
/etc/bind/named.conf.option
/etc/bind/named.conf
/etc/bind/named.conf.local
這邊我只設定自己使用private ip的內部網域
named.conf.options
acl lan {
127.0.0.1;
172.16.0.1/24;
};//設定Access Control List
options {
directory "/var/cache/bind";
allow-query { lan;}; //只讓lan內部的人query
};
注意結尾符號為分號,每一行敘述或一個括號後都要有。
named.conf.local
zone "ljhuang" {
type master;
file "/etc/bind/inter.fwd";
};
zone "0.16.172.in-addr.arpa" {
type master;
file "/etc/bind/inter.rev";
};
正解區: /etc/bind/inter.fwd
$TTL 604800
@ IN SOA aaa.bbb.cc root.aaa.bbb.ccc. (
2009030401 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
$ORIGIN ljhuang.
laptop IN A 172.16.0.1
; CNAME
ip001 IN CNAME laptop
反解區: /etc/bind/inter.rev
$TTL 604800
@ IN SOA aaa.bbb.cc root.aaa.bbb.ccc. (
2009030402 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
$ORIGIN 0.16.172.in-addr.arpa.
1 IN PTR laptop.ljhuang.
參考資料:
鳥哥的 Linux 私房菜 - DNS伺服器
BIND介紹與安裝
Bind9安裝設置指南 - Ubuntu中文