linux部署dns内网服务器

2021年09月16日 阅读数:2
这篇文章主要向大家介绍linux部署dns内网服务器,主要内容包括基础应用、实用技巧、原理机制等方面,希望对大家有所帮助。

安装: yum -y install bind*vim

编辑named.confdom

vim /etc/named.confide

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.zonesoop

// 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

建立解析文件spa

vim test.dianelian.com.zonedebug

$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 stopcode

chkconfig iptables offserver

service named startblog