====== BIND ======
==== Install ====
pkg install bind911
sysrc named_enable="YES"
==== Generate key (note that the service start will do that) ====
rndc-confgen -a
==== Check config ====
named-checkconf
named-checkzone localhost /var/named/
==== Set directory ====
''/usr/local/etc/namedb/named.conf''
options {
...
directory "/usr/local/etc/namedb";
...
}
==== Logging config for debug ====
create log file manually
touch /var/log/named.log
chown bind:bind /var/log/named.log
''/usr/local/etc/namedb/named.conf''
logging {
channel default-log {
file "/var/log/named.log" versions 10 size 200m;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};
category lame-servers { default-log; };
category security{ default-log;};
category queries { default-log;};
category default { default-log;};
};
==== Zone config ====
''/usr/local/etc/namedb/named.conf''
zone "example.org" {
type master;
file "master/example.org";
};
zone "1.168.192.in-addr.arpa" {
type master;
file "master/1.168.192.in-addr.arpa";
};
==== Zone file ====
''/usr/local/etc/namedb/master/example.org''
$TTL 3600 ; 1 hour default TTL
example.org. IN SOA ns1.example.org. admin.example.org. (
2017010301 ; Serial
10800 ; Refresh
3600 ; Retry
604800 ; Expire
300 ; Negative Response TTL
)
; DNS Servers
IN NS ns1.example.org.
; MX Records
IN MX 10 mx.example.org.
IN MX 20 mail.example.org.
; Machine Names
@ IN A 192.168.1.1
ns1 IN A 192.168.1.2
mail IN A 192.168.1.3
; Aliases
www IN CNAME example.org.
==== reverse zone file ====
''/usr/local/etc/namedb/master/1.168.192.in-addr.arpa''
@ IN SOA example.org. admin.example.org. (
2017010301 ; serial
14400 ; refresh
3600 ; retry
604800 ; expire
10800 ; minimum
)
1.168.192.in-addr.arpa. IN NS ns1.example.org.
2 IN PTR ns1.example.org.
3 IN PTR mail.example.org.
==== Start service ====
service named start
[[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 安全設定]]