linux部署dns内网服务器

时间:2022-09-17 08:35:35

安装: yum -y install bind*

编辑named.conf

vim /etc/named.conf

linux部署dns内网服务器linux部署dns内网服务器
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";
    allow-query     { any; };
    recursion yes;
#DNS转发配置
    forward first;
    forwarders {8.8.8.8;};

    dnssec-enable yes;
    dnssec-validation yes;

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

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

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

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

#zone "dianelian.com" IN {
#    type master;
#    file "/var/named/test.dianelian.com";
#};

#zone "66.16.172.in-addr.arpa" IN {
#    type master;
#    file "dianelian.172.16.66.0";
#};


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

vim named.rfc1912.zones

linux部署dns内网服务器linux部署dns内网服务器
// 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; };
};

##电e连
#zone。配置域时请注意“;”分号。
zone "dianelian.com" IN {
type master;
file "test.dianelian.com.zone";
};
                
View Code

创建解析文件

vim test.dianelian.com.zone

linux部署dns内网服务器linux部署dns内网服务器
$TTL 3600
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN NS   172.16.66.152.
test    IN A    172.16.66.151
View Code

service iptables stop

chkconfig iptables off

service named start