11gR2 RAC SCAN DNS简单配置

今天又被SCAN给折磨了,索性一不做二不休就研究了一下DNS,看了很多文档,相比其他人的配置来说,我弄了一个还算简单的配置,先看我的环境.

[root@rac1 named]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1        rac1.localdomain rac1 localhost.localdomain localhost
::1        localhost6.localdomain6 localhost6

192.168.56.135    rac1.localdomain    rac1
192.168.56.136    rac2.localdomain    rac2

10.10.10.101    rac1-priv.localdomain    rac1-priv
10.10.10.102    rac2-priv.localdomain    rac2-priv

192.168.56.137    rac1-vip.localdomain    rac1-vip
192.168.56.138    rac2-vip.localdomain    rac2-vip

192.168.56.139    rac-scan.localdomain    rac-scan
192.168.56.140    rac-scan.localdomain    rac-scan
192.168.56.141    rac-scan.localdomain    rac-scan

1.安装相关软件包

[root@rac1 Server]# rpm -Uvh bind-9.3.6-4.P1.el5.x86_64.rpm
warning: bind-9.3.6-4.P1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
package bind-9.3.6-4.P1.el5.x86_64 is already installed
[root@rac1 Server]# rpm -Uvh bind-libs-9.3.6-4.P1.el5.x86_64.rpm
warning: bind-libs-9.3.6-4.P1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
package bind-libs-9.3.6-4.P1.el5.x86_64 is already installed
[root@rac1 Server]# rpm -Uvh bind-utils-9.3.6-4.P1.el5.x86_64.rpm
warning: bind-utils-9.3.6-4.P1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
package bind-utils-9.3.6-4.P1.el5.x86_64 is already installed

2.配置/named.conf文件

在/etc下面创建一个全局配置文件叫named.conf,加入下列信息.

options {
directory "/var/named";                                           ----ZONE文件存放目录,后面我们要建2个ZONE,一个是正向解析,一个是反向
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";         ----统计内存文件
forwarders { 192.168.56.135 ;};                                   ----这里就填本机IP地址
};
zone "." IN {                                    ----根ZONE,这里最好把根ZONE的文件设置为/dev/null,如果此处不设置为空,校验会报PRVF-5636
	type hint;
	file "/dev/null";
};
zone  "localdomain" IN {                                          ----正向解析区域,此处就填/etc/host文件下的domain,我的就是localdomain
type master;
file "localdomain.zone";                                          ----正向解析文件名
};
zone  "56.168.192.in-addr.arpa" IN {                              ----反向解析区域,此处就填反过来的IP地址.
type master;
file "56.168.192.in-addr.arpa";                                   ----反向解析文件名
};

3.配置正向解析文件

在/var/named下创建正向解析文件localdomain.zone.此处只需要我们把/etc/hosts下面的名字.域名(rac1.localdomain)中的名字填上,后面加IP地址就行了.

$TTL    86400
@        IN SOA    localhost root.localhost (
42        ; serial (d. adams)
3H        ; refresh
15M        ; retry
1W        ; expiry
1D )        ; minimum
@ IN NS        localhost
localhost   IN A        127.0.0.1
rac1        IN A        192.168.56.135
rac2        IN A        192.168.56.136
rac1-priv   IN A        10.10.10.1
rac2-priv   IN A        10.10.10.2
rac1-vip    IN A        192.168.56.137
rac2-vip    IN A        192.168.56.138
rac-scan    IN A        192.168.56.139
rac-scan    IN A        192.168.56.140
rac-scan    IN A        192.168.56.141

4.配置反向解析文件

在/var/named下创建反向解析文件56.168.192.in-addr.arpa,这里也很简单,我们只需要把IP地址最后一位和我们/etc/hosts下的名字.域名(rac1.localdomain)对应上就行了.

$ORIGIN 56.168.192.in-addr.arpa.
$TTL 1H
@       IN      SOA     maggie.localdomain.     root.maggie.localdomain. (      2
3H
1H
1W
1H )
56.168.192.in-addr.arpa.         IN NS      maggie.localdomain.

135     IN PTR  rac1.localdomain.
136     IN PTR  rac2.localdomain.
137     IN PTR  rac1-vip.localdomain.
138     IN PTR  rac2-vip.localdomain.
139     IN PTR  rac-scan.localdomain.
140     IN PTR  rac-scan.localdomain.
141     IN PTR  rac-scan.localdomain.

上述配置没有配置10.10.10.这个ZONE的,如果要配置,方法很简单,在全局配置文件里面加10.10.10的zone,然后在正向解析里面加内容,然后创建反向解析的ZONE文件就行了.

5.测试DNS解析

在测试之前,我们首先要修改/etc/resolv.conf,增加下列内容

[root@rac1 Server]# more /etc/resolv.conf
nameserver 192.168.56.135
search localdomain
[root@rac1 Server]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]

测试正向解析

[root@rac1 Server]# nslookup rac-scan.localdomain
Server:        192.168.56.135
Address:    192.168.56.135#53

Name:    rac-scan.localdomain
Address: 192.168.56.140
Name:    rac-scan.localdomain
Address: 192.168.56.141
Name:    rac-scan.localdomain
Address: 192.168.56.139

测试反向解析

[root@rac1 Server]# nslookup 192.168.56.139
Server: 192.168.56.135
Address: 192.168.56.135#53

139.56.168.192.in-addr.arpa name = rac-scan.localdomain.

[root@rac1 Server]# nslookup 192.168.56.140
Server:        192.168.56.135
Address:    192.168.56.135#53

140.56.168.192.in-addr.arpa    name = rac-scan.localdomain.

[root@rac1 Server]# nslookup 192.168.56.141
Server:        192.168.56.135
Address:    192.168.56.135#53

141.56.168.192.in-addr.arpa    name = rac-scan.localdomain.

参考文档

Linux: How to Configure the DNS Server for 11gR2 SCAN [ID 1107295.1]

分享到: 更多

Post a Comment

Your email is never published nor shared. Required fields are marked *