1.一、系統初始化(centos7)
centos
1.二、yum安裝bindide
yum install bind-utils bind bind-devel bind-chroot
1.三、配置dns配置文件: 編輯/etc/named.conf測試
options { version "1.1.1"; listen-on port 53 {any;}; directory "/var/named/chroot/etc/"; pid-file "/var/named/chroot/var/run/named/named.pid"; allow-query { any; }; Dump-file "/var/named/chroot/var/log/binddump.db"; Statistics-file "/var/named/chroot/var/log/named_stats"; zone-statistics yes; memstatistics-file "log/mem_stats"; empty-zones-enable no; forward first; ##first:解析的時候先走本地若是本地沒有記錄就去找forwarders轉發 only:僅僅作轉發 forwarders { xx.xx.x.xx; }; }; key "rndc-key" { algorithm hmac-md5; secret "Eqw4hClGExUWeDkKBX/pBg=="; }; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; }; logging { channel warning { file "/var/named/chroot/var/log/dns_warning" versions 10 size 10m; severity warning; print-category yes; print-severity yes; print-time yes; }; channel general_dns { file "/var/named/chroot/var/log/dns_log" versions 10 size 100m; severity info; print-category yes; print-severity yes; print-time yes; }; category default { warning; }; category queries { general_dns; }; }; include "/var/named/chroot/etc/xxxdoc.conf";
1.四、編輯/etc/rndc.keycentos7
key "rndc-key" { algorithm hmac-md5; secret "Eqw4hClGExUWeDkKBX/pBg=="; };
1.五、編輯/etc/rndc.confspa
key "rndc-key" { algorithm hmac-md5; secret "Eqw4hClGExUWeDkKBX/pBg=="; }; options { default-key "rndc-key"; default-server 127.0.0.1; default-port 953; };
1.六、編輯/var/named/chroot/etc/lxxxdoc.confcode
zone "linkdoc.com" IN { type master; file "xxxoc.com.zone"; };
1.七、編輯/var/named/chroot/etc/lnh.com.zoneorm
$TTL 120 @ IN SOA tjdns.xxxkdoc.com. root.xxxkdoc.com. ( 20190311001 ; serial 600 ; refresh (15 minutes) 1800 ; retry (10 minutes) 86400 ; expire (1 day) 3600 ; minimum (1 hour) ) @ IN NS tjdns.xxxkdoc.com. @ IN A 172.11.11.11 ;本地IP tjdns IN A 172.11.11.11 cooder IN A 172.22.22.22
1.八、修改目錄權限,並啓動服務server
cd /var && chown -R named.named named/ /etc/init.d/named start chkconfig named on
1.九、測試解析dns
dig @127.0.0.1 xxx.xxxdoc.com