您的位置:首页 > 其它

对智能DNS的master和slave同步的一点总结

2009-12-26 12:17 253 查看
对智能DNS的master和slave的同步测试进行了将近半个月,总是陷入种种的错误和谜团,甚至是产生过放弃测试的念头。然后总是在自己认为无路可走的情况下,柳暗花明。此次将经验总结出来,希望在正式搭建以及其他人进行测试的时候能少遇到一些问题。
一、获取ip分配的方法
获得中国电信、网通、铁通IP段的四种方法:
详见:http://blog.csdn.net/liuyunfengheda/archive/2009/12/26/5080446.aspx
中间比较适合使用的也就是方法二了,测试的过程中也尝试使用其他的方法,但是使用感觉不如方法二直接和方便,特别是4的方法,因为软件需要破解,或者付费才能使用,比较复杂。

二、搭建智能DNS(无slave)。
详细的方法可以参照我直接做的搭建过程的blog:http://blog.csdn.net/liuyunfengheda/archive/2009/11/06/4777151.aspx
对于搭建的过程blog中写的都比较详细了,如果有什么疑问,可以再沟通。

三、搭建智能DNS,实现Master和Slave自动同步
这部分的测试耗费的时间是最长的,因为在测试的过程中一直无法实现master和slave的自动同步,同步的过程中总是出现这样可那样的错误。好在能坚持下来,并测试通过。
下面是测试环境以及配置文件,大家可以根据自己的情况作修改,然后搭建实现Master和Slave的自动同步智能DNS服务器。
测试环境:
dx.cfg
acl dx {
192.168.12.249;
192.168.12.253;
X.X.X.X;}; -------这部分是指定电信的ip,需要注意的是上面的两个内网ip是实现同步电信view的两个ip,是必须设置的,不然在同步的过程中就会出现错误。

wt.cfg
acl wt {
192.168.5.246;
192.168.5.247;
any;}; -----原理同上,但是any是只能除了dx之外的所有ip都 走网通的view。

DNS主服务器:
Eth0:192.168.12.249
Eth1:192.168.5.247

/etc/named.conf

options
{
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
pid-file "/var/run/named/named.pid";
forward only;
Forwarders
{
202.102.224.68;
202.102.227.68;
};
allow-query {any;};
allow-transfer {any;};
notify yes;
};

key "rndckey" {
algorithm hmac-md5;
secret "Je8vfxcByy6hnTxHa7M1qQ==";
};

#include "/etc/rndc.key";

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndckey"; };
};

include "dx.cfg";
include "wt.cfg";

view "dxzone" {
match-clients {dx;192.168.12.253;!192.168.5.246;};
allow-transfer {192.168.12.253;};
# allow-update { 192.168.12.253; };
also-notify { 192.168.12.253; };

Zone "."
{
type Hint;
file "named.root";
};

Zone "localhost"
{
type Master;
file "named.localhost";
};

Zone "xxt.cn"
{
type master;
file "telcom.xxt.cn";
};

Zone "xxt.net.cn"
{
type master;
file "telcom.xxt.net.cn";
};
};

view "wtzone" {
match-clients {wt;!192.168.12.253;192.168.5.246;};
allow-transfer {192.168.5.246;};
# allow-update { 192.168.5.246; };
also-notify { 192.168.5.246; };

Zone "."
{
type Hint;
file "named.root";
};

Zone "localhost"
{
type Master;
file "named.localhost";
};

Zone "xxt.cn"
{
type master;
file "unicom.xxt.cn";
};

Zone "xxt.net.cn"
{
type master;
file "unicom.xxt.net.cn";
};
};

从DNS服务器的配置:
Eth0:192.168.12.254
Eth0:1:192.168.12.253
Eth1:192.168.5.246

/etc/named.conf

options
{
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
pid-file "/var/run/named/named.pid";
forward only;
Forwarders
{
202.102.224.68;
202.102.227.68;
};
allow-query {any;};
allow-transfer {any;};
notify yes;
};

key "rndckey" {
algorithm hmac-md5;
secret "Je8vfxcByy6hnTxHa7M1qQ==";
};

#include "/etc/rndc.key";

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndckey"; };
};

include "dx.cfg";
include "wt.cfg";

view "dxzone" {
match-clients {dx;192.168.12.253;!192.168.5.246;};
transfer-source 192.168.12.253;

Zone "."
{
type Hint;
file "named.root";
};

Zone "localhost"
{
type Slave;
file "named.localhost";
masters {192.168.12.249;};
};

Zone "xxt.cn"
{
type Slave;
file "telcom.xxt.cn";
masters {192.168.12.249;};
};

Zone "xxt.net.cn"
{
type Slave;
file "telcom.xxt.net.cn";
masters {192.168.12.249;};
};
};

view "wtzone" {
match-clients {wt;!192.168.12.253;192.168.5.246;};
transfer-source 192.168.5.246;

Zone "."
{
type Hint;
file "named.root";
};

Zone "localhost"
{
type Slave;
file "named.localhost";
masters {192.168.5.247;};
};

Zone "xxt.cn"
{
type Slave;
file "unicom.xxt.cn";
masters {192.168.5.247;};
};

Zone "xxt.net.cn"
{
type Slave;
file "unicom.xxt.net.cn";
masters {192.168.5.247;};
};
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: