此筆記為安裝在Debian上的步驟
Table of Contents
- 安裝Bind9
- 設定
- 用dig工具測試
- Reference
安裝Bind9
1 2 3 4
| apt-get install bind9 apt-get install dnsutils service bind9 restart
|
設定
主要設定檔: /etc/bind/named.conf.local
預設log會在/var/log/syslog
named.conf.local加入以下兩個zone
named.conf.local1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| //正解 zone "abc.com.tw" IN { type master file "/etc/bind/db-abc.com.tw" allow-update { key example.com. } //反解 zone "33.22.11.in-addr.arpa" IN { type master file "/etc/bind/db-11.22.33" } //tsig key for DNS Dynamic upload key example.com. { algorithm hmac-md5 secret "Roa6+m+40vuEHNJbMVTRjg==" }
|
/etc/bind新增並編輯db-abc.com.tw
db-abc.com.tw1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| $TTL 86400 $ORIGIN abc.com.tw. @ 1D IN SOA @ root.abc.com.tw. ( 2005021801 3H 15M 1W 1D ) @ IN NS dns.abc.com.tw. dns.abc.com.tw. IN A 11.22.33.100 @ IN MX 10 ms1 @ IN MX 20 ms2 ms1 IN A 11.22.33.69 ms2 IN A 11.22.33.70 www 10 IN A 11.22.33.85 www 10 IN A 11.22.33.86 web IN CNAME www
|
/etc/bind新增並編輯db-11.22.33
db-11.22.331 2 3 4 5 6 7 8 9 10 11 12 13
| $TTL 86400 @ IN SOA abc.com.tw. root.abc.com.tw. ( 2004102501 28800 14400 3600000 86400 ) IN NS dns.abc.com.tw. 69 IN PTR ms1 70 IN PTR ms2 85 IN PTR www 86 IN PTR www 100 IN PTR dns
|
用dig工具測試
1 2 3
| dig @localhost www.abc.com.tw dig @localhost -x 11.22.33.100 dig @localhost abc.com.tw axfr
|
正常的話會在Answer Section中有dns 轉換結果
Reference
http://www.l-penguin.idv.tw/article/dns.htm