centos DNS服务器配置

Posted 些许记忆

tags:

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

centos DNS服务器配置

yum install -y bind bind-chroot
sed -i s#localhost#any#g /etc/named.conf
sed -i s#127.0.0.1#any#g /etc/named.conf
sed -i s#listen-on-v6#//listen-on-v6#g /etc/named.conf

cat >/etc/named.conf<<EOF
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;
forward only ;
forwarders { 114.114.114.114; } ;
};
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";
EOF

cp /etc/named.rfc1912.zones /etc/named.rfc1912.zones.bak
cat >>/etc/named.rfc1912.zones<<EOF
zone "test.com" IN {
    type master;
    file"test.com.zone";
    allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
    type master;
    file"192.168.1.zone";
    allow-update { none; };
};
EOF

cat >>/var/named/test.com.zone<<EOF
@   IN SOA  test.com.  root.test.com. (
              0   ; serial
              1D  ; refresh
              1H  ; retry
              1W  ; expire
              3H )  ; minimum
   IN  NS  dns.test.com.
dns   IN  A   192.168.1.7
test   IN  A   192.168.1.7
www   IN  A   192.168.1.8
EOF
cat >>/var/named/192.168.1.zone<<EOF
@   IN SOA  test.com.  root.test.com. (
              0   ; serial
              1D  ; refresh
              1H  ; retry
              1W  ; expire
              3H )  ; minimum
   IN  NS  dns.test.com.
7  IN  PTR   dns.test.com.
7   IN  PTR   test.test.com.
8   IN  PTR   www.test.com.
EOF 
service named start

 

技术图片

 

以上是关于centos DNS服务器配置的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 7 配置DNS服务器

Centos7.5配置主DNS服务器

LINUX CENTOS7 关于DNS,DHCP,Apache的配置

centos7配置YUM安装DNS服务

CentOS7.0下智能DNS服务配置

CentOS下简单的DNS配置