bind9配置主从服务器同步

2011-02-05 14:44

配置自已的 dns 服务器,当然还需要多台从服务器来提高可靠性,推荐he.net的freedns(五台),或者linode.com的免费dns,只要你在主服务器上配置好域之后,从服务器会自动同步域信息。
主服务器配置文件:

options {
	directory "/etc/bind";
	auth-nxdomain no;
	listen-on {你的主服务器的IPv4地址; };
	##listen-on-v6 {你的主服务器的IPv6地址; };
	listen-on-v6 {none; };
	#allow-transfer {从服务器IP地址; };
	#notify yes;
	#also-notify {从服务器IP地址; };
};
logging {
	channel "named_log" {
	file "/var/cache/bind/named.log" versions 10 size 20m;
	severity info;
	print-category yes;
	print-severity yes;
	print-time yes;
		};
	category default {named_log; };
};
zone "humou.net" {
	type master;
	file "db.humou.net";
	allow-transfer {从服务器IP地址; };
	notify yes;
	also-notify {从服务器IP地址; };
};
zone "1.a.a.b.0.7.4.0.1.0.0.2.ip6.arpa" {
	type master;
	file "db.2001.470.baa1";
	allow-transfer {从服务器IP地址; };
	notify yes;
	also-notify {从服务器IP地址; };
};

从服务器的配置文件
(如果使用第三方的免费dns做从服务器,就不需要本文中的从服务器配置文件了)

options {
	directory "/var/cache/bind";
	auth-nxdomain no;
	listen-on {你的从服务器的IPv4地址; };
	##listen-on-v6 {你的从服务器的IPv6地址; };
	listen-on-v6 {none; };
};
logging {
	channel "named_log" {
	file "/var/cache/bind/named.log" versions 10 size 20m;
	severity info;
	print-category yes;
	print-severity yes;
	print-time yes;
		};
	category default {named_log; };
};
zone "humou.net" {
	type slave;
	file "db.humou.net";
	masters {主服务器的IP地址; };
};
zone "1.a.a.b.0.7.4.0.1.0.0.2.ip6.arpa" {
	type slave;
	file "db.2001.470.baa1";
	masters {主服务器的IP地址; };
};

主从服务器分别配置好之后,只需修改主服务器中的zone文件,(注意soa记录中的Serial值),然后

rndc reconfig

/etc/init.d/bind9 restart

之后,从服务器会自动更新,并在/var/cache/bind目录下生成相应文件,如果无法同步,请自行分析日志文件/var/cache/bind/named.log
如果服务器有多IP,可能无法同步成功,请设置源地址路由,详情查看:/blog/201101261304.html

0 条回复

说两句