码迷,mamicode.com
首页 > 其他好文 > 详细

centos DNS服务器配置

时间:2019-10-21 11:36:28      阅读:377      评论:0      收藏:0      [点我收藏+]

标签:rfc1912   class   only   res   mem   服务器   localhost   recursion   ons   

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服务器配置

标签:rfc1912   class   only   res   mem   服务器   localhost   recursion   ons   

原文地址:https://www.cnblogs.com/blog-lhong/p/11712113.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!