linux部署dns内网服务器

Posted 一条寻找快乐的咸鱼

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux部署dns内网服务器相关的知识,希望对你有一定的参考价值。

安装: yum -y install bind*

编辑named.conf

vim /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";
    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

技术图片
// 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

技术图片
$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

以上是关于linux部署dns内网服务器的主要内容,如果未能解决你的问题,请参考以下文章

docker 部署 coredns(内部域名解析)

docker 部署 coredns(内部域名解析)

DNS Doctoring

Linux----DNS分离解析!

DNS部署

内网LINUX下如何解析虚拟域名