1.1, system initialization (centos7)
1.2, yum install bind
yum install bind-utils bind bind-devel bind-chroot
1.3, configuration dns configuration file: Edit /etc/named.conf
{Options Version "1.1.1"; the listen-ON {Port 53 is the any;}; Directory "/ var / the named / CHROOT / etc /"; PID-File "/ var / the named / CHROOT / var / RUN / the named / the named .pid "; the allow the any-Query {;}; the Dump-File" /var/named/chroot/var/log/binddump.db "; Statistics-File" / var / the named / CHROOT / var / log / named_stats "; statistics yes-Zone; memstatistics-File "log / mem_stats"; empty-Zones-enable nO; forward First; ## First: go local time resolution if there is no local record went forwarders forwarding only: just do forwarded forwarders { 10.111.3.12;}; }; Key "the 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/linkdoc.conf";
1.4, edit /etc/rndc.key
key "rndc-key" { algorithm hmac-md5; secret "Eqw4hClGExUWeDkKBX/pBg=="; };
1.5, edit /etc/rndc.conf
key "rndc-key" { algorithm hmac-md5; secret "Eqw4hClGExUWeDkKBX/pBg=="; }; options { default-key "rndc-key"; default-server 127.0.0.1; default-port 953; };
1.6, edit /var/named/chroot/etc/linkdoc.conf
zone "linkdoc.com" IN { type master; file "linkdoc.com.zone"; };
1.7, edit /var/named/chroot/etc/lnh.com.zone
$TTL 120 @ IN SOA tjdns.linkdoc.com. root.linkdoc.com. ( 20190311001 ; serial 600 ; refresh (15 minutes) 1800 ; retry (10 minutes) 86400 ; expire (1 day) 3600 ; minimum (1 hour) ) @ IN NS tjdns.linkdoc.com. @ IN A 172.11.11.11 ;本地IP tjdns IN A 172.11.11.11 cooder IN A 172.22.22.22
1.8、修改目录权限,并启动服务
cd /var && chown -R named.named named/ /etc/init.d/named start chkconfig named on
1.9、测试解析
dig @127.0.0.1 cooder.linkdoc.com