Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs)

lovehewenyu發表於2013-04-23

Redhat 5.8 作業系統上DNS詳細配置( DNS resolution for SCAN VIPs )

 

1 、準備工作

軟體包支援(bind*、caching-nameserver)

安裝執行 yum install bind* caching-nameserver

看下我已經安裝的有關包

[root@doudou named]# rpm -qa bind* caching-nameserver

bind-utils-9.3.6-20.P1.el5_8.6

bind-libs-9.3.6-20.P1.el5_8.6

bind-chroot-9.3.6-20.P1.el5_8.6

caching-nameserver-9.3.6-20.P1.el5_8.6

bind-9.3.6-20.P1.el5_8.6

開啟named服務、設定開啟啟動

/etc/init.d/named start

chkconfig named on

配置nameserver

[root@doudou named]# ifconfig

eth0       Link encap:Ethernet   HWaddr 00:0C:29:06:FC:D0  

          inet addr:192.168.1.212   Bcast:192.168.1.255   Mask:255.255.255.0

[root@doudou named]# cat /etc/resolv.conf

nameserver 192.168.1.212

nameserver 8.8.8.8

nameserver 4.4.4.4

 

2 、詳細配置

檢視named.caching-nameserver.conf 在作業系統上的位置

[root@doudou named]# cd /etc/

[root@doudou etc]# ls -ln named.*

lrwxrwxrwx 1 0 25    51 04-22 16:52 named.caching-nameserver.conf -> /var/named/chroot/etc/ Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs) Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs) named.caching-nameserver.conf

lrwxrwxrwx 1 0 25    41 04-22 16:52 named.rfc1912.zones -> /var/named/chroot/etc/named.rfc1912.zones

備份並修改named.caching-nameserver.conf (備份是個人習慣) 【注意紅色字型為修改部分】

[root@doudou etc]# cd /var/named/chroot/etc/

[root@doudou etc]# cp -p named.caching-nameserver.conf named.caching-nameserver.conf_backup

[root@doudou etc]# cat named.caching-nameserver.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 localhost 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 { 127.0.0.1; }; == 》127.0.0.1改成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      { localhost; }; ==>localhost 改成any

        allow-query-cache { localhost; }; ==>localhost 改成any

};

logging {

        channel default_debug {

                file "data/named.run";

                severity dynamic;

        };

};

view localhost_resolver {

        match-clients       { localhost; }; ==>localhost 改成any

        match-destinations { localhost; }; ==>localhost 改成any

        recursion yes;

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

};

備份並修改named.rfc1912.zones

[root@doudou etc]# cd /var/named/chroot/etc/

[root@doudou etc]# cp -p named.rfc1912.zones named.rfc1912.zones_backup

[root@doudou etc]# vi named.rfc1912.zones

尾部新增

zone " scan-doudou.com" IN {

        type master;

        file " scan-doudou.com.zone";

        allow-update { none; };

};

zone " Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs) Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs) 1.168.192.in-addr.arpa" IN {

        type master;

        file " 1.168.192.in-addr.arpa.local";

        allow-update { none; };

};

配置正向解析

[root@doudou etc]# cd /var/named/chroot/var/named/

[root@doudou named]# cp -p localhost.zone scan-doudou.com.zone

【紅色字型為新增部分】

[root@doudou named]# vi scan-doudou.com.zone

$TTL     86400

@                IN SOA   @        root (

                                        42               ; serial (d. adams)

                                        3H               ; refresh

                                        15M              ; retry

                                        1W               ; expiry

                                        1D )             ; minimum

 

                IN NS            @

                IN NS            scan-doudou.com

                IN A             127.0.0.1

                IN AAAA          ::1

www              IN A             192.168.1.25

                IN A             192.168.1.211

                IN A             192.168.1.212

配置方向解析

【紅色字型為新增部分】

[root@doudou named]# cp -p named.local 1.168.192.in-addr.arpa.local

[root@doudou named]# vi 1.168.192.in-addr.arpa.local

Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs) Redhat 5.8 作業系統上DNS詳細配置(DNS resolution for SCAN VIPs) $TTL     86400

@        IN       SOA      localhost. root.localhost.   (

                                      1997022700 ; Serial

                                      28800       ; Refresh

                                      14400       ; Retry

                                      3600000     ; Expire

                                      86400 )     ; Minimum

        IN       NS       localhost.

1        IN       PTR      localhost.

                IN NS            scan-doudou.com.

localhost        IN A             127.0.0.1

25       IN       PTR             

211      IN       PTR             

212      IN       PTR             

重啟named服務

[root@doudou named]# /etc/init.d/named restart

停止 named:[確定]

啟動 named:[確定]

 

3 、驗證結果

[root@doudou named]# nslookup

Server:          192.168.1.212

Address:         192.168.1.212#53

 

Name:   

Address: 192.168.1.25

Name:   

Address: 192.168.1.211

Name:   

Address: 192.168.1.212

 

[root@doudou named]# ping

PING (192.168.1.212) 56(84) bytes of data.

64 bytes from 1.168.192.in-addr.arpa (192.168.1.212): icmp_seq=1 ttl=64 time=0.018 ms

[root@doudou named]# ping

PING (192.168.1.211) 56(84) bytes of data.

64 bytes from 1.168.192.in-addr.arpa (192.168.1.211): icmp_seq=1 ttl=64 time=0.560 ms

[root@doudou named]# ping

PING (192.168.1.25) 56(84) bytes of data.

64 bytes from 1.168.192.in-addr.arpa (192.168.1.25): icmp_seq=1 ttl=64 time=0.061 ms

[root@doudou named]# nslookup 192.168.1.211

Server:          192.168.1.212

Address:         192.168.1.212#53

211.1.168.192.in-addr.arpa       name = .

 

4 、DNS使用驗證

另一個機器

[root@doudou-32bit ~]# cat /etc/resolv.conf

nameserver 192.168.1.212

nameserver 8.8.8.8

nameserver 4.4.4.4

[root@doudou-32bit ~]# nslookup

Server:          192.168.1.212

Address:         192.168.1.212#53

 

Name:   

Address: 192.168.1.212

Name:   

Address: 192.168.1.25

Name:   

Address: 192.168.1.211

[root@doudou-32bit ~]# ping

PING (192.168.1.211) 56(84) bytes of data.

64 bytes from doudou-32bit (192.168.1.211): icmp_seq=1 ttl=64 time=0.003 ms

[root@doudou-32bit ~]# ping

PING (192.168.1.25) 56(84) bytes of data.

64 bytes from 1.168.192.in-addr.arpa (192.168.1.25): icmp_seq=1 ttl=64 time=0.219 ms

[root@doudou-32bit ~]# ping

PING (192.168.1.212) 56(84) bytes of data.

64 bytes from 1.168.192.in-addr.arpa (192.168.1.212): icmp_seq=1 ttl=64 time=0.336 ms

[root@doudou-32bit ~]# nslookup 192.168.1.212

Server:          192.168.1.212

Address:         192.168.1.212#53

212.1.168.192.in-addr.arpa       name = .

 

 

總結:

一個簡單的DNS搞了整整一天,但是最終還是成功了,成功還是很高興的。以後安裝RAC,需要使用DNS解析SCAN VIPs 我們就可以搞了。

 

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

相關文章