搭建RAC時配置scanip的DNS環境

翔之天空發表於2017-05-02

在搭建RAC時,scanip需要dns解析,下面演示如何配置dns

 

伺服器環境:rhel-server-7.3-x86_64

域名解析:ol7-122-scan.fly.cn

3個scanip: 192.168.56.105

192.168.56.106

192.168.56.107

 

1、安裝bind包

[root@ol7-122-rac1 ~]# yum list|grep bind-chroot

bind-chroot.x86_64                     32:9.9.4-37.el7             rhel-media  

[root@ol7-122-rac1 ~]# yum -y install  bind-chroot.x86_64

 

 

修改/etc/named.conf 檔案如下:

[root@ol7-122-rac1 named]# more /etc/named.conf

//

// named.caching-nameserver.conf

//

// Provided by Red Hat caching-nameserverpackage to configure the

// ISC BIND named(8) DNS server as acaching only nameserver

// (as a localhost DNS resolver only).

//

// See /usr/share/doc/bind*/sample/ forexample named configuration files.

//

// DO NOT EDIT THIS FILE - usesystem-config-bind or an editor

// to create named.conf - edits to thisfile 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 localhost_resolver {

       match-clients      { any; };

       match-destinations { any; };

       recursion yes;

        include"/etc/named.rfc1912.zones";

};

 

 

2、修改/etc/named.rfc1912.zones檔案

增加以下的正向解析和反向解析資訊

[root@ol7-122-rac1 named]# vi  /etc/named.rfc1912.zones

 

 

zone "fly.cn" IN {

       type master;

         file "fly.cn.zone";

       allow-update { none; };

};

 

zone "56.168.192.in-addr.arpa" IN{

       type master;

       file "56.168.192.local";

       allow-update { none; };

};

 

 

3、新增正向解析檔案

(如配置不當會報錯 zonefly.cn/IN: NS 'dns.fly.cn' has no address records (A or AAAA),參考附1; 此處演示正常檔案):

[root@ol7-122-rac1 named]# vi /var/named/fly.cn.zone

$TTL   86400

@               IN SOA  dns.fly.cn. root.fly.cn. (

                                        42              ; serial (d. adams)

                                        3H              ; refresh

                                       15M             ; retry

                                        1W              ; expiry

                                        1D)            ; minimum

                IN NS           dns.fly.cn.

ol7-122-scan            IN A           192.168.56.105

ol7-122-scan            IN A           192.168.56.106

ol7-122-scan            IN A           192.168.56.107

 

dns.fly.cn.     IN A            192.168.56.101

dns.fly.cn.     IN A            192.168.56.102

 

 

4、新增反向解析檔案:

[root@ol7-122-rac1 named]# vi /var/named/56.168.192.local

$TTL   86400

@      IN      SOA     dns.fly.cn. root.fly.cn.  (

                                     1997022700 ; Serial

                                     28800      ; Refresh

                                      14400      ; Retry

                                     3600000    ; Expire

                                      86400)    ; Minimum

       IN      NS      dns.fly.cn.

105    IN      PTR     ol7-122-scan.fly.cn.

106    IN      PTR     ol7-122-scan.fly.cn.

107    IN      PTR     ol7-122-scan.fly.cn.

 

 

5、配置/etc/resolv.conf檔案,

解析dns

[root@ol7-122-rac1 named]# vi /etc/resolv.conf

# Generated by NetworkManager

search localdomain

nameserver 192.168.56.101

 

重啟dns

[root@ol7-122-rac1 named]# systemctl restart named

 

6、檢測dns是否好用

[root@ol7-122-rac1 named]# nslookup  ol7-122-scan.fly.cn

Server:         192.168.56.101

Address:        192.168.56.101#53

 

Name:  ol7-122-scan.fly.cn

Address: 192.168.56.105

Name:  ol7-122-scan.fly.cn

Address: 192.168.56.106

Name:  ol7-122-scan.fly.cn

Address: 192.168.56.107

 

 

 

附1:zone fly.cn/IN: NS 'dns.fly.cn' has no address records (A or AAAA) 問題

 

問題:

初始配置正向解析檔案時如下:

[root@ol7-122-rac1 named]# vi/var/named/fly.cn.zone

$TTL   86400

@              IN SOA  dns.fly.cn. root.fly.cn. (

                                        42              ; serial (d. adams)

                                        3H              ; refresh

                                       15M             ; retry

                                        1W              ; expiry

                                        1D)            ; minimum

                IN NS           dns.fly.cn.

ol7-122-scan            IN A           192.168.56.105

ol7-122-scan            IN A           192.168.56.106

ol7-122-scan            IN A           192.168.56.107

 

 

重啟dns時報錯

[root@ol7-122-rac1 named]# systemctlrestart named

Starting named:

Error in named configuration:

zone localhost.localdomain/IN: loadedserial 0

zone localhost/IN: loaded serial 0

zone1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN:loaded serial 0

zone 1.0.0.127.in-addr.arpa/IN: loadedserial 0

zone 0.in-addr.arpa/IN: loaded serial 0

zone fly.cn/IN: NS 'dns.fly.cn' has noaddress records (A or AAAA)

zone fly.cn/IN: not loaded due to errors.

localhost_resolver/fly.cn/IN: bad zone

zone 56.168.192.in-addr.arpa/IN: loadedserial 1997022700

[FAILED]

 

 

解決方案:

 

在正向解析檔案新增如下資訊:

[root@ol7-122-rac1 named]# vi/var/named/fly.cn.zone

 

dns.fly.cn.     IN A            192.168.56.101

dns.fly.cn.     IN A            192.168.56.102

 

 

再次重啟dns時無問題

[root@ol7-122-rac1 named]# systemctlrestart named

相關文章