首页 > 技术文章 > CentOS DNS 安裝步驟

jbite9057 2019-12-27 15:10 原文

yum install bind bind-utils bind-devel bind-chroot

 

[root@nw-centos-dns-01 ~]# rpm -qa | grep bind
bind-license-9.11.4-9.P2.el7.noarch
bind-export-libs-9.11.4-9.P2.el7.x86_64
bind-libs-9.11.4-9.P2.el7.x86_64
bind-libs-lite-9.11.4-9.P2.el7.x86_64
bind-utils-9.11.4-9.P2.el7.x86_64
bind-chroot-9.11.4-9.P2.el7.x86_64
rpcbind-0.2.0-48.el7.x86_64
bind-9.11.4-9.P2.el7.x86_64

 

vi /etc/named.conf

//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// See the BIND Administrator's Reference Manual (ARM) for details about the
// configuration located in /usr/share/doc/bind-{version}/Bv9ARM.html

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;

        bindkeys-file "/etc/named.root.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 "it.local" IN {
        type master;
        //the file that mapping host name to IP
        file "named.it.local";
        allow-transfer { 10.39.1.204; };
};

zone "cctv.local" IN {
        type master;
        ////the file that mapping host name to IP
        file "named.cctv.local";
        allow-transfer { 10.39.1.204; };
};

zone "1.39.10.in-addr.arpa" IN {
        type master;
        file "named.1.39.10.in-addr.arpa";
        allow-transfer { 10.39.1.204; };
};
include "/etc/named.root.key";
include "/etc/named.rfc1912.zones";

vi /var/named/anmed.it.local

$TTL 600  //strictly can't use space as head
@       IN SOA  @ nw-centos.it.local. (
                                        14      ; serial  //Serial number should be change when change this file 
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum

@                      IN NS    dns1.it.local.
@                      IN NS    dns2.it.local.
nw-centos-dns-01       IN A     10.39.1.203
nw-centos-dns-02       IN A     10.39.1.204


dns1            IN  A     10.39.1.203
dns2            IN  A     10.39.1.204
zabbix          IN  A     10.39.0.108
prtgph01        IN  A     10.39.0.102
prtghk01        IN  A     10.39.0.132

啟用named服務

systemctl restart named

推荐阅读