yum install bind-chroot bind  -y
cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/

touch /var/named/chroot/var/named/data/cache_dump.db

touch /var/named/chroot/var/named/data/named_stats.txt

touch /var/named/chroot/var/named/data/named_mem_stats.txt

touch /var/named/chroot/var/named/data/named.run

mkdir /var/named/chroot/var/named/dynamic

touch /var/named/chroot/var/named/dynamic/managed-keys.bind

chmod -R 777 /var/named/chroot/var/named/data

chmod -R 777 /var/named/chroot/var/named/dynamic

cp -p /etc/named.conf /var/named/chroot/etc/named.conf

vim /var/named/chroot/etc/named.conf

options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
#       recursing-file  "/var/named/data/named.recursing";
#       secroots-file   "/var/named/data/named.secroots";
        allow-query     { any; };
        recursion yes;
        dnssec-enable yes;
        dnssec-validation yes;

        forwarders {
                114.114.114.114;
        };

        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";

        managed-keys-directory "/var/named/dynamic";

        pid-file "/run/named/named.pid";
        session-keyfile "/run/named/session.key";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

zone "weiheng.ink" {
    type master;
    file "weiheng.local.zone";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";

配置解析文件

vim /var/named/chroot/var/named/weiheng.local.zone

$TTL 86400
@ IN SOA weiheng.local. hostmaster.weiheng.local. (
  2       ; Serial
  604800     ; Refresh
  86400     ; Retry
  2419200    ; Expire
  604800 )   ; Minimum
;         Define the nameservers and the mail servers
@ IN NS ns1.weiheng.local.
@ IN A 127.0.0.1



vm1              IN      A       10.1.1.2
vm2              IN      A       10.1.1.3
vm3              IN      A       10.1.1.4
vm4              IN      A       10.1.1.5
vm5              IN      A       10.1.1.6
ns1              IN      A       10.1.1.6
ns2              IN      A       10.1.1.5
/usr/libexec/setup-named-chroot.sh /var/named/chroot on

systemctl start named-chroot

systemctl enable named-chroot

systemctl status named-chroot
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。