Pages

Tuesday 28 August 2012

Step by step DNS Configuration on Linux

       Step by step DNS Configuration on Linux RHEL5/OEL5

Welcome to our page. In this page we are going to discuss about Domain Name Server(DNS) configuration. Later the same DNS configuration going to use Oracle 11g Release 2 Real Application Cluster (RAC) Installations.


Step 1 : Login as root and install below listed Bind RPM's.

rpm -Uvh bind-9.3.3-7.el5.i386.rpm \
bind-chroot-9.3.3-7.el5.i386.rpm \

bind-devel-9.3.3-7.el5.i386.rpm \

bind-libbind-devel-9.3.3-7.el5.i386.rpm \

bind-libs-9.3.3-7.el5.i386.rpm \

bind-sdb-9.3.3-7.el5.i386.rpm \

system-config-bind-4.0.3-2.el5.noarch.rpm \

caching-nameserver-9.3.3-7.el5.i386.rpm \
postgresql-libs-8.1.4-1.1.i386.rpm
 
Step 2: Verify the IP address for the DNS server. Use following command to check the IP address.

[root@dnc ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:7D:60:F3
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe7d:60f3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:28 errors:0 dropped:0 overruns:0 frame:0
TX packets:39 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4919 (4.8 KiB) TX bytes:5628 (5.4 KiB)
Interrupt:67 Base address:0x2024

Step 3: There are four files we have to edit. Find the below easy steps to configure the DNS server.

1. Create a named.conf file using sample named.caching-nameserver.conf file.
[root@dnc ~]# cd /var/named/chroot/etc/
[root@dnc etc]# ls
localtime named.caching-nameserver.conf named.rfc1912.zones rndc.key
[root@dnc etc]#cp named.caching-nameserver.conf named.conf

2. Edit the named.conf file based on your configuration. For example.

options {
listen-on port 53 { 192.168.1.100; };
# 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 { localhost; };
        };
logging {
        channel default_debug {
        file "data/named.run";
        severity dynamic;
        };
};
view localhost_resolver {
        match-clients { any; };
        match-destinations { 192.168.1.100; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

3. Edit named.rfc1912.zones file. Sample file given below.


zone "." IN {
              type hint;
              file "named.ca";
};
zone "india.com" IN {
                 type master;
                 file "forward.zone";
                 allow-update { none; };
};
zone "localhost" IN {
                 type master;
                 file "localhost.zone";
                 allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
                 type master;
                 file "reverse.zone";
                 allow-update { none; };
};
..

4. Change the permission to the above two files.

chgrp named named.conf

5. Change the directory to below location

cd /var/named/chroot/var/named
cp localdomain.zone forward.zone
cp named.local reverse.zone
 
6. Modify the forward.zone file. example

$TTL 86400
@          IN     SOA    dnc.india.com.  root.dnc.india.com. (
                         42 ; serial (d. adams)
                         3H ; refresh
                        15M ; retry
                         1W ; expiry
                         1D ) ; minimum
          IN   NS     dnc.india.com.
dnc       IN   A      192.168.1.100
 
7. Modify the reverse.zone file

$TTL 86400
@        IN     SOA    dnc.india.com.    root.dnc.india.com. (
                       1997022700 ; Serial
                            28800 ; Refresh
                            14400 ; Retry
                          3600000 ; Expire
                          86400 ) ; Minimum
         IN   NS   dnc.india.com.
100      IN   PTR  dnc.india.com.

 
8. Change the ownership for both the files.

chgrp named reverse.zone
chgrp named forward.zone

9. make an entry to both /etc/hosts and /etc/resolv.conf files. The samples are below.

cat /etc/hosts
192.168.1.100 dnc.india.com dnc
cat /etc/resolve.conf
search india.com
namedserver 192.168.1.100

10. Restart the named services using below statement.

service named restart

11. Verify the DNS server using below statements


[root@dnc named]# dig dnc.india.com
; «» DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 «» dnc.india.com
;; global options: printcmd
;; Got answer:
;; -»HEADER«- opcode: QUERY, status: NOERROR, id: 1483
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;dnc.india.com. IN A
;; ANSWER SECTION:
dnc.india.com. 86400 IN A 192.168.1.100
;; AUTHORITY SECTION:
india.com. 86400 IN NS dnc.india.com.
;; Query time: 1 msec
;; SERVER: 192.168.1.100#53(192.168.1.100)
;; WHEN: Mon Aug 27 23:54:49 2012
;; MSG SIZE rcvd: 61

12. To check reverse the zone


[root@dnc named]# dig -x 192.168.1.100
; «» DiG 9.3.6-P1-RedHat-9.3.6-4.P1.el5_4.2 «» -x 192.168.1.100
;; global options: printcmd
;; Got answer:
;; -»HEADER«- opcode: QUERY, status: NOERROR, id: 55949
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
;; QUESTION SECTION:
;100.1.168.192.in-addr.arpa. IN PTR
;; ANSWER SECTION:
100.1.168.192.in-addr.arpa. 86400 IN PTR dnc-priv.india.com.
100.1.168.192.in-addr.arpa. 86400 IN PTR dnc.india.com.
;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400 IN NS dnc.india.com.
;; ADDITIONAL SECTION:
dnc.india.com. 86400 IN A 192.168.1.100
;; Query time: 1 msec
;; SERVER: 192.168.1.100#53(192.168.1.100)
;; WHEN: Mon Aug 27 23:57:27 2012
;; MSG SIZE rcvd: 124

13. To verify DNS Server using nslookup

[root@dnc named]# nslookup dnc.india.com
Server: 192.168.1.100
Address: 192.168.1.100#53
Name: dnc.india.com
Address: 192.168.1.100

DNS server working fine now. Finally we got success.

14. For Oracle 11gR2 RAC Installation adding node Information in /var/named/chroot/var/named/forward.zone file on DNS server. 


$TTL    86400
@               IN SOA  dnc.india.com. root.dnc.india.com. (
                                        42              ; serial (d. adams)
                                        3H              ; refresh
                                        15M             ; retry
                                        1W              ; expiry
                                        1D )            ; minimum
                IN NS           dnc.india.com.
dnc             IN A            192.168.1.100
kracnode1       IN A    192.168.1.50
kracnode2       IN A    192.168.1.51
kracnode1-vip   IN A    192.168.1.60
kracnode2-vip   IN A    192.168.1.61
kracnode-scan   IN A    192.168.1.70
kracnode-scan   IN A    192.168.1.71
kracnode-scan   IN A    192.168.1.72

15.  Restart named service as a root user.


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


16. Verify the SCAN names using nslookup. 


[root@dnc named]# nslookup kracnode-scan
Server:         192.168.1.100
Address:        192.168.1.100#53

Name:   kracnode-scan.india.com
Address: 192.168.1.72
Name:   kracnode-scan.india.com
Address: 192.168.1.70
Name:   kracnode-scan.india.com
Address: 192.168.1.71


17. Add below files in /etc/resolv.conf  file on all the nodes.

search india.com
nameserver 192.168.1.100



[oracle@krac1 ]# cat /etc/resolv.conf
search india.com
nameserver 192.168.1.100
[root@krac1 bin]# nslookup kracnode-scan
Server:         192.168.1.100
Address:        192.168.1.100#53

Name:   kracnode-scan.india.com
Address: 192.168.1.71
Name:   kracnode-scan.india.com
Address: 192.168.1.72
Name:   kracnode-scan.india.com
Address: 192.168.1.70

18. DNS server ready for Oracle 11gR2 RAC setup go ahead and start RAC installation using below blog.

Oracle 11gR2 RAC Installation Steps on Linux


-------------------------------------------------------------------------------------------------------------------------------------