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

DNS 主从同步

时间:2015-09-16 20:15:27      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:域名服务器   recursion   

一:主域名服务器.

[root@localhost ~]# vim /etc/named.conf

----------------------------------------------------------------

options {

        listen-on port 53 { 199.100.77.137; };

        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 no;

        allow-transfer { 199.100.77.138; };

        dnssec-enable yes;

        dnssec-validation yes;

        dnssec-lookaside auto;


        /* 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 "snptc.com" IN {

        type master;

        file "masters/snptc.zone";

};


zone "77.100.199.in-addr.arpa" IN {

        type master;

        file "masters/zone.77.100.199";

};

include "/etc/named.rfc1912.zones";

include "/etc/named.root.key";

----------------------------------------------------------

[root@localhost ~]#mkdir /var/named/masters

[root@localhost ~]#chown named:named /var/named/masters

[root@localhost ~]# vi /var/named/masters/snptc.zone 

------------------------------------------------------

$TTL 1D

@       IN SOA  ns1.snptc.com admin.snptc.com. (

                                        201502  ; serial

                                        1D      ; refresh

                                        1H      ; retry

                                        1W      ; expire

                                        3H )    ; minimum

@       IN      NS      ns1.snptc.com.

@       IN      NS      ns2.snptc.com.

@       IN      MX 10   mail.snptc.com.

ns1     IN      A       199.100.77.137

ns2     IN      A       199.100.77.138

mail    IN      A       199.100.77.138

www     IN      A       199.100.77.137

------------------------------------------------------------

[root@localhost ~]#vim /var/named/masters/zone.77.100.199

---------------------------------------------------------

$TTL 1D
@       IN SOA  ns1.snptc.com admin.snptc.com. (
                                        201502  ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN      NS      ns1.snptc.com.
@       IN      NS      ns2.snptc.com.
@       IN      MX 10   mail.snptc.com.
137     IN      PTR     ns1.snptc.com.
137     IN      PTR     www.snptc.com.
138     IN      PTR     mail.snptc.com.
138     IN      PTR     ns2.snptc.com.

-----------------------------------------------------

[root@localhost ~]# service named restart

停止 named:.                                              [确定]

启动 named:                                               [确定]

客户端测试

    [root@localhost ~]# dig -t A www.snptc.com @199.100.77.137 

    [root@localhost ~]# dig -x 199.100.77.138 @199.100.77.137


二:从域名服务器:


[root@localhost ~]# vi /etc/named.conf

 ----------------------------------------------

options {

        listen-on port 53 { 199.100.77.138; };

        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 no;


        dnssec-enable yes;

        dnssec-validation yes;

        dnssec-lookaside auto;


        /* 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 "snptc.com" IN {

        type slave;

        file "slaves/snptc.zone";

        masters { 199.100.77.137; };

};



zone "77.100.199.in-addr.arpa" IN {

        type slave;

        file "slaves/zone.77.100.199";

        masters { 199.100.77.137; };

};


include "/etc/named.rfc1912.zones";

include "/etc/named.root.key";

----------------------------------------------


 

[root@localhost ~]# service named restart

停止 named:                                               [确定]

启动 named:                                               [确定]

客户端测试


[root@localhost ~]# dig -t A www.snptc.com @199.100.77.137 

[root@localhost ~]# dig -x 199.100.77.138 @199.100.77.137





        


本文出自 “86962983” 博客,请务必保留此出处http://wangzenghui.blog.51cto.com/9702487/1695397

DNS 主从同步

标签:域名服务器   recursion   

原文地址:http://wangzenghui.blog.51cto.com/9702487/1695397

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