ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

centos DNS服务器配置

2019-10-21 10:52:45  阅读:62  来源: 互联网

标签:named DNS centos v6 etc sed conf 服务器



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

 

 



标签:named,DNS,centos,v6,etc,sed,conf,服务器

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有