RAC 11.2.0.3 SACN與DNS配置

snowdba發表於2014-07-20
本機是雙節點的RAC, SCAN IP為192.168.1.203
[root@node1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.

127.0.0.1       localhost
::1             localhost6.localdomain6 localhost6

#node1
192.168.1.191   node1.localdomain       node1
192.168.1.193   node1-vip.localdomain   node1-vip
172.168.1.11    node1-priv.localdomain  node1-priv

#node2
192.168.1.192   node2.localdomain                node2
192.168.1.194   node2-vip.localdomain            node2-vip
172.168.1.12    node2-priv.localdomain           node2-priv

#scan-ip
192.168.1.203   scan-cluster.localdomain        scan-cluster


由於資源有限,用節點node1所在的伺服器作為DNS伺服器進行配置

步驟一,安裝bind rpm包

檢查是否安裝了bind包
[root@node1 ~]# rpm -qa | grep bind
bind-utils-9.3.6-16.P1.el5
ypbind-1.19-12.el5_6.1
bind-libs-9.3.6-16.P1.el5

透過yum來安裝bind
[root@node1 ~]# yum install bind
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
oel5                                                                 | 1.1 kB     00:00    
Setting up Install Process
Resolving Dependencies
--&gt Running transaction check
---&gt Package bind.x86_64 30:9.3.6-16.P1.el5 set to be updated
--&gt Finished Dependency Resolution

Dependencies Resolved

============================================================================================
 Package          Arch               Version                         Repository        Size
============================================================================================
Installing:
 bind             x86_64             30:9.3.6-16.P1.el5              oel5             988 k

Transaction Summary
============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 988 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bind                                                                 1/1

Installed:
  bind.x86_64 30:9.3.6-16.P1.el5                                                           

Complete!


[root@node1 ~]# yum install bind-chroot
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--&gt Running transaction check
---&gt Package bind-chroot.x86_64 30:9.3.6-16.P1.el5 set to be updated
--&gt Finished Dependency Resolution

Dependencies Resolved

============================================================================================
 Package               Arch             Version                        Repository      Size
============================================================================================
Installing:
 bind-chroot           x86_64           30:9.3.6-16.P1.el5             oel5            46 k

Transaction Summary
============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 46 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : bind-chroot                                                          1/1

Installed:
  bind-chroot.x86_64 30:9.3.6-16.P1.el5                                                    

Complete!


[root@node1 ~]# yum install caching-nameserver
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--&gt Running transaction check
---&gt Package caching-nameserver.x86_64 30:9.3.6-16.P1.el5 set to be updated
--&gt Finished Dependency Resolution

Dependencies Resolved

============================================================================================
 Package                    Arch           Version                       Repository    Size
============================================================================================
Installing:
 caching-nameserver         x86_64         30:9.3.6-16.P1.el5            oel5          62 k

Transaction Summary
============================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 62 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : caching-nameserver                                                   1/1

Installed:
  caching-nameserver.x86_64 30:9.3.6-16.P1.el5                                             

Complete!


步驟二,配置named.conf

透過複製named.catching-nameserver.conf檔案來生成named.conf
注意cp命令後面的 -p引數用來確保許可權,生成的named.conf 組屬於為root named

[root@node1]# cp -p /var/named/chroot/etc/named.caching-nameserver.conf /var/named/chroot/etc/named.conf

將127.0.0.1 改成 any
:%s/127.0.0.1/any/g

將 localhost 改成 any
:%s/localhost/any/g 

[root@node1 etc]# vi /var/named/chroot/etc/named.conf

//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a any DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//
options {
        listen-on port 53 { any; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        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";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { any; };
        allow-query-cache { any; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view any_resolver {
        match-clients      { any; };
        match-destinations { any; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

 
步驟三, 建立域
[root@node1 etc]# vi /var/named/chroot/etc/named.rfc1912.zones
在檔案末尾追加下列資訊

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


配置正、反解析資料庫檔案
[root@node1 named]# cp -p /var/named/chroot/var/named/named.local /var/named/chroot/var/named/1.168.192.in-addr.arpa
[root@node1 named]# ll
total 40
-rw-r----- 1 root  named  426 Jan 14  2011 1.168.192.in-addr.arpa
drwxrwx--- 2 named named 4096 Aug 26  2004 data
-rw-r----- 1 root  named  198 Jan 14  2011 localdomain.zone
-rw-r----- 1 root  named  195 Jan 14  2011 localhost.zone
-rw-r----- 1 root  named  427 Jan 14  2011 named.broadcast
-rw-r----- 1 root  named 1892 Jan 14  2011 named.ca
-rw-r----- 1 root  named  424 Jan 14  2011 named.ip6.local
-rw-r----- 1 root  named  426 Jan 14  2011 named.local
-rw-r----- 1 root  named  427 Jan 14  2011 named.zero
drwxrwx--- 2 named named 4096 Jul 27  2004 slaves


在正向解析資料庫檔案localdomain.zone末尾追加
echo "scan-cluster IN A 192.168.1.203" >> /var/named/chroot/var/named/localdomain.zone

[root@node1 ~]# vi /var/named/chroot/var/named/localdomain.zone

$TTL    86400
@               IN SOA  localhost root (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           localhost
localhost       IN A            127.0.0.1
scan-cluster  IN A   192.168.1.203

配置反向解析資料檔案
[root@node1 ~]# echo “191 IN PTR  scan-cluster.localdomain." >> /var/named/chroot/var/named/1.168.192.in-addr.arpa
[root@node1 ~]# vi /var/named/chroot/var/named/1.168.192.in-addr.arpa

$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.
191 IN PTR  scan-cluster.localdomain.   <==191 為節點node1的IP地址地址 192.168.1.191最後一組數字

在節點node1,node2分別新增/etc/resolv.conf檔案
[root@node1 ~]# echo "search localdomain
> nameserver 192.168.1.181" >> /etc/resolv.conf
[root@node1 ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.1.181

[root@node2 ~]# echo "search local domain
> nameserver 192.168.1.181" >> /etc/resolv.conf
[root@node2 ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.1.181 

步驟四,啟動DNS服務
在節點node1上啟動DNS服務
[root@node1 named]# /etc/init.d/named  status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped
[root@node1 named]# /etc/init.d/named start
Starting named: [  OK  ]
[root@node1 named]# /etc/init.d/named status
number of zones: 7
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/1000
tcp clients: 0/100
server is up and running
named (pid  8273) is running...
[root@node1 named]#  


步驟五,測試DNS
[root@node1 ~]# nslookup 192.168.1.191
Server:         192.168.1.191
Address:        192.168.1.191#53

191.1.168.192.in-addr.arpa      name = scan-cluster.localdomain.

[root@node1 ~]# nslookup scan-cluster.localdomain
Server:         192.168.1.191
Address:        192.168.1.191#53

Name:   scan-cluster.localdomain
Address: 192.168.1.203

[root@node1 ~]# nslookup scan-cluster
Server:         192.168.1.191
Address:        192.168.1.191#53

Name:   scan-cluster.localdomain
Address: 192.168.1.203


[root@node2 ~]# cat /etc/resolv.conf
search localdomain
nameserver 192.168.1.191
[root@node2 ~]# nslookup scan-cluster
Server:         192.168.1.191
Address:        192.168.1.191#53

Name:   scan-cluster.localdomain
Address: 192.168.1.203

[root@node2 ~]#
[root@node2 ~]#
[root@node2 ~]# nslookup scan-cluster.localdomain
Server:         192.168.1.191
Address:        192.168.1.191#53

Name:   scan-cluster.localdomain
Address: 192.168.1.203





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29047826/viewspace-1223072/,如需轉載,請註明出處,否則將追究法律責任。

相關文章