差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
bind [2017/01/04 00:42] 127.0.0.1 |
bind [2017/01/10 22:47] (目前版本) jz |
||
---|---|---|---|
行 1: | 行 1: | ||
====== BIND ====== | ====== BIND ====== | ||
- | + | ==== Install ==== | |
- | ==== install ==== | + | <code> |
pkg install bind911 | pkg install bind911 | ||
sysrc named_enable="YES" | sysrc named_enable="YES" | ||
+ | </code> | ||
- | ==== generate key (note that the service start will do that) ==== | + | ==== Generate key (note that the service start will do that) ==== |
+ | <code> | ||
rndc-confgen -a | rndc-confgen -a | ||
+ | </code> | ||
- | ==== check config ==== | + | ==== Check config ==== |
<code> | <code> | ||
named-checkconf | named-checkconf | ||
行 16: | 行 18: | ||
</code> | </code> | ||
- | ==== set directory ==== | + | ==== Set directory ==== |
+ | ''/usr/local/etc/namedb/named.conf'' | ||
<code> | <code> | ||
options { | options { | ||
- | // All file and path names are relative to the chroot directory, | + | ... |
- | // if any, and should be fully qualified. | + | |
directory "/usr/local/etc/namedb"; | directory "/usr/local/etc/namedb"; | ||
... | ... | ||
行 26: | 行 28: | ||
</code> | </code> | ||
- | ==== debug config ==== | + | ==== Logging config for debug ==== |
+ | create log file manually | ||
+ | |||
+ | <code bash> | ||
+ | touch /var/log/named.log | ||
+ | chown bind:bind /var/log/named.log | ||
+ | </code> | ||
+ | |||
+ | ''/usr/local/etc/namedb/named.conf'' | ||
<code> | <code> | ||
logging { | logging { | ||
行 32: | 行 42: | ||
file "/var/log/named.log" versions 10 size 200m; | file "/var/log/named.log" versions 10 size 200m; | ||
severity info; | severity info; | ||
+ | print-category yes; | ||
print-severity yes; | print-severity yes; | ||
print-time yes; | print-time yes; | ||
行 42: | 行 53: | ||
</code> | </code> | ||
- | ==== zone ==== | + | ==== Zone config ==== |
+ | ''/usr/local/etc/namedb/named.conf'' | ||
<code> | <code> | ||
zone "example.org" { | zone "example.org" { | ||
type master; | type master; | ||
file "master/example.org"; | file "master/example.org"; | ||
+ | }; | ||
+ | |||
+ | zone "1.168.192.in-addr.arpa" { | ||
+ | type master; | ||
+ | file "master/1.168.192.in-addr.arpa"; | ||
}; | }; | ||
</code> | </code> | ||
- | ==== zone file ==== | + | ==== Zone file ==== |
+ | ''/usr/local/etc/namedb/master/example.org'' | ||
<code> | <code> | ||
$TTL 3600 ; 1 hour default TTL | $TTL 3600 ; 1 hour default TTL | ||
行 79: | 行 96: | ||
==== reverse zone file ==== | ==== reverse zone file ==== | ||
+ | ''/usr/local/etc/namedb/master/1.168.192.in-addr.arpa'' | ||
<code> | <code> | ||
@ IN SOA example.org. admin.example.org. ( | @ IN SOA example.org. admin.example.org. ( | ||
行 92: | 行 110: | ||
3 IN PTR mail.example.org. | 3 IN PTR mail.example.org. | ||
</code> | </code> | ||
+ | |||
+ | ==== Start service ==== | ||
+ | <code bash> | ||
+ | service named start | ||
+ | </code> | ||
+ | |||
[[http://wiki.weithenn.org/cgi-bin/wiki.pl?bind9-%E6%8F%90%E4%BE%9BDomain_Name%E8%88%87IP%E5%B0%8D%E6%87%89%E7%9A%84%E6%9C%8D%E5%8B%99|bind 安全設定]] | [[http://wiki.weithenn.org/cgi-bin/wiki.pl?bind9-%E6%8F%90%E4%BE%9BDomain_Name%E8%88%87IP%E5%B0%8D%E6%87%89%E7%9A%84%E6%9C%8D%E5%8B%99|bind 安全設定]] |