(二)
主从架构DNS服务器的配置
需要两台虚拟机
一个作为主DNS服务器,一个作为辅助DNS服务器
需要先创建/var/named/named.ca
#dig -t NS . > /var/named/named.ca
接下来配置主DNS服务器:
#vim /etc/named.conf
-----------------------
options {
directory "/var/named";
};
zone "." IN {
type hint;
file “named.ca”;
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "a.org" IN {
type master;
file "a.org.zone";
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "192.168.0.zone";
};
----------------------------------
配置区域文件:
#cd /var/named/
#vim localhost.zone
-------------------
$TTL 86400
@ 600 IN SOA localhost. admin.localhost. (
2011081601
1H
10M
7D
1D )
@ IN NS localhost.
localhost. IN A 127.0.0.1
-------------------
#vim named.local
-------------------
$TTL 86400
@ 600 IN SOA localhost. admin.localhost. (
2011081601
1H
10M
7D
1D )
@ IN NS localhost.
1 IN PTR localhost.
-------------------
#vim a.org.zone
需要指定辅助DNS服务器
-------------------
$TTL 1200
@ IN SOA ns1.a.org. admin.a.org. (
2011081601
1H
10M
7D
1D )
@ IN NS ns1.a.org.(dns服务器的名字)
@ IN NS ns2.a.org.
@ IN MX 10 mail.a.org.
ns1.a.org. IN A 192.168.0.15 (主DNS服务器的地址)
ns2.a.org. IN A 192.168.0.130 (辅助DNS服务器的地址)
mail.a.org. IN A 192.168.0.15
. IN A 192.168.0.158
bbs.a.org. IN CNAME
. IN A 192.168.0.164
-------------------
#vim 192.168.0.zone
-------------------
$TTL 1200
@ IN SOA ns1.a.org. admin.a.org. (
2011081601
1H
10M
7D
1D )
@ IN NS ns1.a.org.
@ IN NS ns2.a.org.
15 IN PTR ns1.a.org.
130 IN PTR ns2.a.org.
15 IN PTR mail.a.org.
158 IN PTR .
164 IN PTR .
#service named start
-------------------
好的,接下来你可以验证一下你的配置是否正确,是否能够解析到。
如果你验证成功了,那接下来我们就开始配置辅助DNS服务器
在另一虚拟机上
你同样需要配置一下文件:
/etc/named.conf,/var/named/named.ca,/var/named/localhost.zone,/var/named/named.local
我这里就直接复制过来,再稍微修改一下
#scp /var/named
#scp /var/named
#scp /var/named
#scp /etc
#chown :named /etc/named.conf named.* localhost.zone
--------------------
#vim /etc/named.conf
--------------------
options {
directory "/var/named";
};
zone "." IN {
type hint;
file “named.ca”;
};
zone "localhost" IN {
type master;
file "localhost.zone";
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
};
zone "a.org" IN {
type slave;
file "slaves/a.org.zone";
master { 192.168.0.164; };
};
zone "0.168.192.in-addr.arpa" IN {
type slave;
file "slaves/192.168.0.zone";
masters { 192.168.0.164; };
};
#service named start
辅助DNS服务器就会同步主DNS服务器中的数据。会同步两个文件,分别为a.org.zone和192.168.0.zone。分别位于/var/named/slaves/.
阅读(1315) | 评论(0) | 转发(0) |