redhat6.5關於rac配置DNS的問題

zhangsharp20發表於2016-09-11
Three packages must be installed on Linux for DNS Server:

  • bind (includes DNS server, named)
  • bind-utils (utilities for querying DNS servers about host information)
  • bind-libs (libraries used by the bind server and utils package)


You can obtain an account from the Yum Server which will install the package for you automatically.  

OR 

You can manually download these packages:   

  • bind.XXX.rpm (for example bind-9.2.4-22.el3.i386.rpm)
  • bind-utils.XXX.rpm
  • bind-libs.XX.rpm

On  dns system edit the "/etc/named.conf" file

[root@ora4 named]# cat /etc/named.conf
//
// named.conf
//
// Provided by Red Hat bind package to configure the ISC BIND named(8) DNS
// server as a caching only nameserver (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//


options {
        listen-on port 53 { any; };       #必須改成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";
        allow-query     { any; };     #必須改成any,否則其他機器無法執行域名解析
        recursion yes;


        dnssec-enable yes;
        dnssec-validation yes;
        dnssec-lookaside auto;


        /* Path to ISC DLV key */
        bindkeys-file "/etc/named.iscdlv.key";


        managed-keys-directory "/var/named/dynamic";
};


logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};


zone "." IN {
        type hint;
        file "named.ca";
};


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


zone "ora.com" IN {
type master;
file "ora.com.zone";           #aaaa.zone是/var/named下的反向解析檔案
allow-update { none; };
};


#zone "162.168.192.in-addr.arpa." IN {
#type master;
#file "162.168.192.in-addr.arpa";
#allow-update { none; };
#};
[root@ora4 named]# 

配置反向解析檔案

[root@ora4 named]# cat /etc/named.rfc1912.zones 
// named.rfc1912.zones:
//
// Provided by Red Hat caching-nameserver package 
//
// ISC BIND named zone configuration for zones recommended by
// RFC 1912 section 4.1 : localhost TLDs and address zones
// and
// (c)2007 R W Franks
// 
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//


zone "localhost.localdomain" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};


zone "localhost" IN {
        type master;
        file "named.localhost";
        allow-update { none; };
};


zone "1.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 {
        type master;
        file "named.loopback";
        allow-update { none; };
};


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


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


zone "162.168.192.in-addr.arpa" IN {
        type master;
        file "aaaa.zone";             #aaaa.zone是/var/named下的反向解析檔案
        allow-update { none; };
};


[root@ora4 named]# cp -p named.localhost aaaa.zone ora.com.zone



編輯正反向解析檔案


正向解析:
[root@ora4 named]# cat ora.com.zone 
$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
scan-ip IN A 192.168.162.7
scan-ip IN A 192.168.162.8
scan-ip IN A 192.168.162.9

反向解析:

[root@ora4 named]# cat aaaa.zone 
$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1


162.168.192.in-addr.arpa. IN NS scan-ip.ora.com.
7 IN PTR scan-ip.ora.com.
8 IN PTR scan-ip.ora.com.
9 IN PTR scan-ip.ora.com.


新增的兩個檔案必須能夠被named使用者讀寫
啟動DNS服務

[root@ora4 named]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]



測試:

正向測試
[root@ora4 named]# nslookup scan-ip.ora.com
Server:         127.0.0.1
Address:        127.0.0.1#53


Name:   scan-ip.ora.com
Address: 192.168.162.7
Name:   scan-ip.ora.com
Address: 192.168.162.8
Name:   scan-ip.ora.com
Address: 192.168.162.9

反向測試:
[root@ora4 named]# nslookup 192.168.162.9
Server:         127.0.0.1
Address:        127.0.0.1#53


9.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora4 named]# nslookup 192.168.162.8
Server:         127.0.0.1
Address:        127.0.0.1#53


8.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora4 named]# nslookup 192.168.162.7
Server:         127.0.0.1
Address:        127.0.0.1#53


7.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


RAC節點測試:

一節點:
[root@ora1 ~]# nslookup scan-ip.ora.com
Server:         192.168.162.126
Address:        192.168.162.126#53


Name:   scan-ip.ora.com
Address: 192.168.162.7
Name:   scan-ip.ora.com
Address: 192.168.162.8
Name:   scan-ip.ora.com
Address: 192.168.162.9


[root@ora1 ~]# nslookup 192.168.162.8
Server:         192.168.162.126
Address:        192.168.162.126#53


8.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora1 ~]# nslookup 192.168.162.7
Server:         192.168.162.126
Address:        192.168.162.126#53


7.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora1 ~]# nslookup 192.168.162.9
Server:         192.168.162.126
Address:        192.168.162.126#53


9.162.168.192.in-addr.arpa      name = scan-ip.ora.com.

二節點:

[root@ora2 Packages]# nslookup scan-ip.ora.com
Server:         192.168.162.126
Address:        192.168.162.126#53


Name:   scan-ip.ora.com
Address: 192.168.162.8
Name:   scan-ip.ora.com
Address: 192.168.162.9
Name:   scan-ip.ora.com
Address: 192.168.162.7


[root@ora2 Packages]# nslookup 192.168.162.7
Server:         192.168.162.126
Address:        192.168.162.126#53


7.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora2 Packages]# nslookup 192.168.162.8
Server:         192.168.162.126
Address:        192.168.162.126#53


8.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora2 Packages]# nslookup 192.168.162.9
Server:         192.168.162.126
Address:        192.168.162.126#53


9.162.168.192.in-addr.arpa      name = scan-ip.ora.com.



三節點:


[root@ora3 ~]# nslookup scan-ip.ora.com
Server:         192.168.162.126
Address:        192.168.162.126#53


Name:   scan-ip.ora.com
Address: 192.168.162.9
Name:   scan-ip.ora.com
Address: 192.168.162.7
Name:   scan-ip.ora.com
Address: 192.168.162.8


[root@ora3 ~]# nslookup 192.168.162.7
Server:         192.168.162.126
Address:        192.168.162.126#53


7.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora3 ~]# nslookup 192.168.162.8
Server:         192.168.162.126
Address:        192.168.162.126#53


8.162.168.192.in-addr.arpa      name = scan-ip.ora.com.


[root@ora3 ~]# nslookup 192.168.162.9
Server:         192.168.162.126
Address:        192.168.162.126#53


9.162.168.192.in-addr.arpa      name = scan-ip.ora.com.

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

相關文章