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


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

13 comments:

  1. Very good this tutorial. researched several websites and only with your help I was able to configure the DNS server. Thank you.

    ReplyDelete
  2. Thanks yaar !!! Really needed such usefull tuts..!!!

    ReplyDelete
  3. hi Kavinprakaash Subramaniam,

    i(Anbu) have done the same DNS configuration as what you mentioned above.. and when i check with nslookup from dns server, its working fine, but when i try the same from any nodes, am getting this error ";; connection timed out; no servers could be reached"

    can you please help us to solve this issues..

    anilanbu@gmail.com

    ReplyDelete
    Replies
    1. Turn firewall off in dns and other nodes
      please run the below cmd
      # /etc/rc.d/init.d/iptables stop

      Delete
    2. hi Prakaash,

      i have same issue even after disabling firewall how to fix this?
      From 192.168.1.17 icmp_seq=1 Destination Host Unreachable


      thanks in advance.

      Delete
  4. Hi Kavinprakaash,

    Configured the SCAN ip's in DNS and working fine, In cluster installation "TASK RESOLV.CONFG INTEGRITY" failed in pre-request steps.

    How to resolve the issue? Please guide me.

    Thanks.

    ReplyDelete
  5. Hi,
    Can this tutorial be used to install it for RHEL 6?

    arch:printing-4.0-ia32:printing-4.0-noarch
    Distributor ID: RedHatEnterpriseServer
    Description: Red Hat Enterprise Linux Server release 6.0 (Santiago)
    Release: 6.0

    Thanks,
    Juan.

    ReplyDelete
  6. great Work.. Have successfully configured DNS Server following the above steps.
    Note: change /etc/resolve.conf to /etc/resolv.conf ....
    Thanks

    ReplyDelete
  7. Dear, excellent work , good tutorial

    ReplyDelete
  8. Hi. Thank you so much. Very helpful. My office is using /etc/hosts rather than DNS. I thought DNS was the Oracle Best Practice. Is that true? Both for the server name itself and for SCAN? Please advise.
    Again, thank you so much. Your blogs are very clear, accurate, helpful and easy to understand.

    ReplyDelete
  9. Excellent article, It works great. I tried in my home.

    ReplyDelete

Note: only a member of this blog may post a comment.