centos7下dns服务器bind主从配置文件样例

配置文件/etc/named.rfc1912.zones 

主:

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package 
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
// 
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

zone "localhost.localdomain" IN {
    type master;
    file "named.localhost";
    allow-update { none; };
};

zone "localhost" IN {
    type master;
    file "named.localhost";
    allow-update { none; };
};

zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
    type master;
    file "named.loopback";
    allow-update { none; };
};

zone "1.0.0.127.in-addr.arpa" IN {
    type master;
    file "named.loopback";
    allow-update { none; };
};

zone "0.in-addr.arpa" IN {
    type master;
    file "named.empty";
    allow-update { none; };
};

zone "skieer.net" IN {
        type master;
        file "/var/named/skieer.net.zone";
        allow-update { none; };
};

zone "10.in-addr.arpa" IN {
        type master;
        also-notify { 10.105.8.58; };
        allow-transfer { 10.105.8.58; };
        file "/var/named/10.in-addr.arpa.zone";
};

zone "tencentyun.com" IN {
        type forward;
        forwarders { 10.236.158.114;10.236.158.106; };
};

从:

// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package 
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt
// (c)2007 R W Franks
// 
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//

#zone "localhost.localdomain" IN {
#    type master;
#    file "named.localhost";
#    allow-update { none; };
#};

#zone "localhost" IN {
#    type master;
#    file "named.localhost";
#    allow-update { none; };
#};

#zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
#    type master;
#    file "named.loopback";
#    allow-update { none; };
#};

#zone "1.0.0.127.in-addr.arpa" IN {
#    type master;
#    file "named.loopback";
#    allow-update { none; };
#};

#zone "0.in-addr.arpa" IN {
#    type master;
#    file "named.empty";
#    allow-update { none; };
#};


zone "skieer.net" IN {
        type slave;
        file "/var/named/skieer.net.zone";
        masters { 10.105.224.68; };
#        allow-transter { none; };
};

zone "10.in-addr.arpa" IN {
        type slave;
        file "/var/named/10.in-addr.arpa.zone";
         masters { 10.105.224.68;};
#        allow-transfer { none; };
};

主:

/var/named/skieer.net.zone

$TTL 1D
@    IN SOA    dns1.skieer.net. rname.invalid. (
                    20180802    ; serial
                    1D    ; refresh
                    1H    ; retry
                    1W    ; expire
                    3H )    ; minimum
@      IN       NS     dns1.skieer.net.
dns1.skieer.net. IN  A 10.105.224.68
dns2.skieer.net. IN A 10.105.8.58
elasticsearch.skieer.net.     IN  A       10.1.6.9
kibana.skieer.net. IN  A       10.1.6.13
java.skieer.net.   IN  A       10.1.6.3
logstash.skieer.net. IN A      10.1.6.11
mssql-master.skieer.net.   IN A       10.105.44.125
mssql-mirror               IN A       10.105.38.7
10_105_38_7                IN CNAME   mssql-mirror

主:

/var/named/10.in-addr.arpa.zone

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
105.224.68   IN       PTR       dns1.skieer.net.
105.8.58     IN       PTR       dns2.skieer.net.
1.6.9        IN       PTR       elasticsearch.skieer.net.
1.6.13       IN       PTR       kibana.skieer.net.
1.6.3        IN       PTR       java.skieer.net.
1.6.11       IN       PTR       logstash.skieer.net.
105.44.125   IN       PTR       mssql-master.

主:

/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 { 10.105.224.68; };
    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";
    allow-query     { any; };
        forward first;
        forwarders { 10.236.158.114;10.236.158.106; };
#        forwarders { 183.60.83.19;183.60.82.98;};
        allow-transfer { 10.105.224.68; 10.105.8.58; };
        allow-query-cache { any;};
        notify  yes;
#       forward  only;

    /* 
     - If you are building an AUTHORITATIVE DNS server, do NOT enable recursion.
     - If you are building a RECURSIVE (caching) DNS server, you need to enable 
       recursion. 
     - If your recursive DNS server has a public IP address, you MUST enable access 
       control to limit queries to your legitimate users. Failing to do so will
       cause your server to become part of large scale DNS amplification 
       attacks. Implementing BCP38 within your network would greatly
       reduce such attack surface 
    */
    recursion yes;

    dnssec-enable yes;
    dnssec-validation yes;

    /* 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";
};

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

【备注】:其他不用修改

检测配置文件是否错误:named-checkconf

重载配置文件:rndc reload

猜你喜欢

转载自blog.csdn.net/kevinsingapore/article/details/81706342