在Solaris上配置RR-DNS域名解析

小编辑 发布于 2010/04/25 16:52
阅读 676
收藏 0

这几天在进行的JES proxy的测试,由于proxy去后端Web server的负载均衡器有点问题,因此我需要在JES proxy(Solaris环境/t5120)上配置RR-DNS,使得所有去后端拿内容的请求可以平均的分配在这些web server上。
由 于我在测试的过程当中,我是在/etc/hosts下指明后端的负载均衡的IP的。因为我现在把RR-DNS配置在了proxy server这台机器上面,因此后端的负载均衡的IP也就是proxy server这台机器的IP,现在以例子的形式说明。
现在假设JES proxy的IP地址为10.0.0.1,5台Web server的IP为192.168.1.1/2/3/4/5
bash-3.00# more /etc/hosts
#
# Internet host table
#
::1 localhost
127.0.0.1 localhost
10.0.0.1 T5120 midend.A.com.com t5120.prc.com loghost

然后开始配置RR—DNS
1.配置 etc/named.conf
options {
directory "/var/named";
pid-file "/var/named/named.pid";
rrset-order{
class IN type A name "backend.A.com" order cyclic;
};
multiple-cnames yes;
recursion no;
listen-on { 127.0.0.1; };
};

logging {
category queries { null; };
};


zone "." in {
type hint;
file "root.doc";
};

zone "A.com" in {
type master;
file "named.A.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" in {
type master;
file "named.local.zone";
allow-update { none; };
};

zone "1.168.192.in-addr.arpa" in {
type master;
file "rev.A.zone";
allow-update { none; };
};

注释:
rrset-order {
[ class class_name ]
[ type type_name ]
[ name "domain_name"]
order ordering }; //ordering 可为 fixed / random / cyclic
#
范例 :
rrset-order {class IN type A name "sip.com" order random;};
rrset-order 多笔 FQDN 时响应的方法,也就是当您有 Round Robin 的数据(一个名称对应到多个 RDATA)时,其响应的方式:
random: 随机选取,原来之系统默认值
cyclic: 循环式回答,即有三笔资料的话,即依 1->2->3->1->2…回答
2.创建多个配置文件
#mkdir /var/named
由于proxy要为前端的多个不同的域名服务,如
1.A.com
2.A.com
3.A.com
...
因 此需要把这些域名放到一个文件
#cat >cnm
1.A.com IN CNAME backend.A.com
2.A.com IN CNAME backend.A.com
3.A.com IN CNAME backend.A.com
4.A.com IN CNAME backend.A.com
#cat >named.local.zone
$TTL 84000
;
; SOA rec
@ IN SOA midend.A.com root.midend.A.com (
2000011116 ;
10800 ;
3600 ;
604800 ;
84000 ) ;

0.0.127.in-addr.arpa. IN NS midend.A.com.
1 IN PTR localhost.

bash-3.00# cat >named.A.zone
$TTL 1s
;
; SOA rec
@ IN SOA midend.A.com root.midend.A.com (
2000011116 ;
10800 ;
3600 ;
604800 ;
0 ) ;

A.com. IN NS midend.A.com.
localhost. IN A 127.0.0.1
midend.A.com. IN A 10.0.0.1
backend.A.com. IN A 192.168.1.1
backend.A.com. IN A 192.168.1.2
backend.A.com. IN A 192.168.1.3
backend.A.com. IN A 192.168.1.4
backend.A.com. IN A 192.168.1.5

; CNAME aliases.

1.A.com. IN CNAME backend.A.com.
2.A.com. IN CNAME backend.A.com.
3.A.com. IN CNAME backend.A.com.
4.A.com. IN CNAME backend.A.com.
#cat > rev.A.zone
$TTL 1s
;
; SOA rec
@ IN SOA midend.A.com root.midend.A.com (
2000011116 ;
10800 ;
3600 ;
604800 ;
0 ) ;

1.168.192.in-addr.arpa. IN NS midend.A.com.
1 IN PTR backend.A.com.
2 IN PTR backend.A.com.
3 IN PTR backend.A.com.
4 IN PTR backend.A.com.
5 IN PTR backend.A.com.
#cat >root.doc
; This file holds the information on root name servers needed to
; initialize cache of Internet domain name servers
; (e.g. reference this file in the "cache . <file>"
; configuration file of BIND domain name servers).
;
; This file is made available by InterNIC
; under anonymous FTP as
; file /domain/named.root
; on server FTP.INTERNIC.NET
; -OR- RS.INTERNIC.NET
;
; last update: Feb 04, 2008
; related version of root zone: 2008020400
;
; formerly NS.INTERNIC.NET
;
. 3600000 IN NS A.ROOT-SERVERS.NET.
A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4
A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30
;
; formerly NS1.ISI.EDU
;
. 3600000 NS B.ROOT-SERVERS.NET.
B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201
;
; formerly C.PSI.NET
;
. 3600000 NS C.ROOT-SERVERS.NET.
C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12
;
; formerly TERP.UMD.EDU
;
. 3600000 NS D.ROOT-SERVERS.NET.
D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90
;
; formerly NS.NASA.GOV
;
. 3600000 NS E.ROOT-SERVERS.NET.
E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10
;
; formerly NS.ISC.ORG
;
. 3600000 NS F.ROOT-SERVERS.NET.
F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241
F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2f::f
;
; formerly NS.NIC.DDN.MIL
;
. 3600000 NS G.ROOT-SERVERS.NET.
G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4
;
; formerly AOS.ARL.ARMY.MIL
;
. 3600000 NS H.ROOT-SERVERS.NET.
H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53
H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803f:235
;
; formerly NIC.NORDU.NET
;
. 3600000 NS I.ROOT-SERVERS.NET.
I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17
;
; operated by VeriSign, Inc.
;
. 3600000 NS J.ROOT-SERVERS.NET.
J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30
J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30
;
; operated by RIPE NCC
;
. 3600000 NS K.ROOT-SERVERS.NET.
K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129
K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7fd::1
;
; operated by ICANN
;
. 3600000 NS L.ROOT-SERVERS.NET.
L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42

然后启动DNS的服务
#/usr/sbin/named –c /etc/named.conf
# ps -ef | grep named

加载中
返回顶部
顶部