How to configure DNS in RHEL 5

16 views
Skip to first unread message

parmod kushwaha

unread,
Jul 15, 2010, 2:09:06 AM7/15/10
to redhathcl...@googlegroups.com

Dear Sir
 
How to configure DNS in RHEL 5.

Parmod Saini
 

AAnand Kashyap

unread,
Jul 15, 2010, 5:22:42 AM7/15/10
to redhathcl...@googlegroups.com

*Step By Step Configuration of DNS*
-----------------------------------

[root@server1 ~]# yum install bind*
[root@server1 ~]# yum install caching-nameserver

[root@server1 ~]# cd /var/named/chroot

[root@server1 chroot]# cd etc

[root@server1 etc]# cp  named.caching-nameserver.conf   named.conf
[root@server1 etc]# cat named.rfc1912.zones     >> named.conf
[root@server1 etc]# chgrp named named.conf
[root@server1 etc]# vi named.conf
     
      Change the following lines
      --------------------------
      .
      .
      listen-on port 53 { 192.168.1.12; };          //ip adderss of the system
      .
      .
      .
      .
      allow-query     { 192.168.1.0/24; };          //Network address
      .
      .

      Make comment of these lines
      ---------------------------
      // logging {
      //        channel default_debug {
      //                file "data/named.run";
      //                severity dynamic;
      //        };
      // };
      // view localhost_resolver {
      //      match-clients      { localhost; };
      //      match-destinations { localhost; };
      //      recursion yes;
      //      include "/etc/named.rfc1912.zones";
      // };

      Add the following lines
      -----------------------

      zone "example.com" IN {
            type master;
            file "forward.zone";
      };

      zone "1.168.192.in-addr.arpa" IN {
            type master;
            file "reverse.zone";
      };

Save and exit the file
----------------------
:wq

[root@server1 etc]# cd ../var/named
[root@server1 named]# cp localdomain.zone forward.zone
[root@server1 named]# cp named.local      reverse.zone
[root@server1 named]# chgrp named forward.zone
[root@server1 named]# chgrp named reverse.zone
[root@server1 named]# vi forward.zone
     
          
      Original File
       ---------------
      1 $TTL    86400
      2 @               IN SOA  localhost root (
      3                                         42              ; serial (d. adams)
      4                                         3H              ; refresh
      5                                         15M             ; retry
      6                                         1W              ; expiry
      7                                         1D )            ; minimum
      8                 IN NS           localhost
      9 localhost       IN A            127.0.0.1
     

      Modified File
      -------------

      1     $TTL    86400
      2 @               IN SOA  server1 root (
      3                         -------         42              ; serial (d. adams)
      4                                         3H              ; refresh
      5                                         15M             ; retry
      6                                         1W              ; expiry
      7                                         1D )            ; minimum
      8                         IN NS           server1
      9                         IN A            192.168.1.12
     10 server1                 IN A            192.168.1.12
     
[root@server1 named]# vi reverse.zone

      Original File
       ---------------

      1 $TTL    86400
      2 @       IN      SOA     localhost. root.localhost.  (
      3                                       1997022700 ; Serial
      4                                       28800      ; Refresh
      5                                       14400      ; Retry
      6                                       3600000    ; Expire
      7                                       86400 )    ; Minimum
      8         IN      NS      localhost.
      9 1       IN      PTR     localhost.

      Modified File
      -------------
                                                                                                                            
      1 $TTL    86400
      2 @       IN      SOA     server1.example.com. root.server1.example.com.  (
      3                                       1997022700 ; Serial
      4                                       28800      ; Refresh
      5                                       14400      ; Retry
      6                                       3600000    ; Expire
      7                                       86400 )    ; Minimum
      8         IN      NS      server1.example.com.
      9 12      IN      PTR     server1.example.com.

[root@server1 named]# vi /etc/resolv.conf
     
      Add this line
        -------------
      nameserver 192.168.1.12

[root@server1 named]# service named restart
[root@server1 named]# chkconfig named on

[root@server1 named]# dig server1.example.com
; <<>> DiG 9.3.4-P1 <<>> server1.example.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65231
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;server1.example.com.           IN      A

;; ANSWER SECTION:
server1.example.com.    86400   IN      A       192.168.1.12

;; AUTHORITY SECTION:
example.com.            86400   IN      NS      server1.example.com.

;; Query time: 1 msec
;; SERVER: 192.168.1.53#53(192.168.1.12)
;; WHEN: Mon Aug 24 18:58:05 2009
;; MSG SIZE  rcvd: 67

[root@server1 named]# dig -x 192.168.1.12
; <<>> DiG 9.3.4-P1 <<>> -x 192.168.1.12
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29761
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;12.1.168.192.in-addr.arpa.     IN      PTR

;; ANSWER SECTION:
12.1.168.192.in-addr.arpa. 86400 IN     PTR     server1.example.com.

;; AUTHORITY SECTION:
1.168.192.in-addr.arpa. 86400   IN      NS      server1.example.com.

;; ADDITIONAL SECTION:
server1.example.com.    86400   IN      A       192.168.1.12

;; Query time: 0 msec
;; SERVER: 192.168.1.12#53(192.168.1.12)
;; WHEN: Mon Aug 24 18:58:53 2009
;; MSG SIZE  rcvd: 106


[root@server1 named]# host 192.168.1.12
12.1.168.192.in-addr.arpa domain name pointer server1.example.com.

[root@server1 named]# host server1.example.com
server1.example.com has address 192.168.1.12

[root@server1 named]# nslookup
> 192.168.1.12
Server:         192.168.1.12
Address:        192.168.1.12#53

12.1.168.192.in-addr.arpa       name = server1.example.com.
> server1.example.com
Server:         192.168.1.12
Address:        192.168.1.12#53

Name:   server1.example.com
Address: 192.168.1.12
> exit

[root@server1 named]#



** Now Step By Step Configuration of Slave DNS Server **

Before Configure the Slave DNS, Master & Slave computers are should be synchronize with Date/Time
(Means Both computer have same date and time)

Steps needed in Master Computer
-------------------------------

[root@server1 ~]# cd /var/named/chroot
[root@server1 chroot]# cd etc
[root@server1 etc]# vi named.conf

      then add the following line
        ---------------------------
      options {
            .
            .
            .
            allow-transfer { 192.168.1.53; };    // the ip address of Slave machine
            .
            .
            .
      };
     
save and exit
:wq

[root@server1 etc]# cd ../var/named
[root@server1 named]# vi forward.zone

      then add the IN NS and A entry as follows
      -----------------------------------
                  IN NS station1
                  IN A  192.168.1.53

      station1    IN A  192.168.1.53

save and exit
:wq

[root@server1 named]# vi reverse.zone
     
      then add the IN NS and PTR entry as follows
      -----------------------------------
            IN    NS    station1.example.com.
      53    IN    PTR   station1.example.com.

save and exit
:wq

Steps needed in Slave Computer
-------------------------------


[root@station1 ~]# yum install bind*
[root@station1 ~]# yum install caching-nameserver

[root@station1 ~]# cd /var/named/chroot

[root@station1 chroot]# cd etc

[root@station1 etc]# cp  named.caching-nameserver.conf   named.conf
[root@station1 etc]# cat named.rfc1912.zones    >> named.conf
[root@station1 etc]# chgrp named named.conf
[root@station1 etc]# vi named.conf
     
      Change the following lines
      --------------------------
      .
      .
      listen-on port 53 { 192.168.1.53 };          //ip adderss of the system
      .
      .
      .
      .
      allow-query     { 192.168.1.0/24; };          //Network address
      .
      .

      Make comment of these lines
      ---------------------------
      // logging {
      //        channel default_debug {
      //                file "data/named.run";
      //                severity dynamic;
      //        };
      // };
      // view localhost_resolver {
      //      match-clients      { localhost; };
      //      match-destinations { localhost; };
      //      recursion yes;
      //      include "/etc/named.rfc1912.zones";
      // };

      Add the following lines
      -----------------------

      zone "example.com" IN {
            type slave;
            masters { 192.168.1.12; };
            file "slaves/forward.zone";
      };

      zone "1.168.192.in-addr.arpa" IN {
            type slave;
            masters { 192.168.1.12; };
            file "slaves/reverse.zone";
      };

Save and exit the file
----------------------
:wq
     
[root@station1 named]# vi /etc/resolv.conf
     
      Add this line
        -------------
      nameserver 192.168.1.12

[root@station1 named]# service named restart
[root@station1 named]# chkconfig named on









 



--
You received this message because you are subscribed to the Google Groups "RedHat.hclcdc.janakpuri" group.
To post to this group, send an email to redhathcl...@googlegroups.com.
To unsubscribe from this group, send email to redhathcljanakp...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redhathcljanakpuri?hl=en-GB.



--
Thanks & Regards

AAnand Kashyap
9650955997

parmod kushwaha

unread,
Jul 16, 2010, 1:39:32 AM7/16/10
to redhathcl...@googlegroups.com
Dear Sir

Thanks a lot , I do same steps & its working but when I hit command

# host 192.168.0.2 
      then I am getting this error  .
1.) Error--  Host 2.0.168.192.in-addr.arpa not found: 3(NXDOMAIN)

2.) & when I hit command # dig -x 192.168.0.2

then I dont get answer section
;;ANSWER SECTION:
2.0.168.192.in-addr.arpa.86400 IN PTR prserver.example.com  &
 also ADDITIONAL SECTION


I think this error due to reverse .zone file (am i right ?)
server name = prserver.example.com
server ip      = 192.168.0.2
I have attached named.conf ,forward.zone & reverse.zone file for your reference.


Parmod Saini
forward.zone
reverse.zone
named.conf

parmod kushwaha

unread,
Jul 18, 2010, 5:15:14 AM7/18/10
to redhathcl...@googlegroups.com
Dear Sir

Error which mention below  is resolved.

1.) Error--  Host 2.0.168.192.in-addr.arpa not found: 3(NXDOMAIN)


Thank you Sir for all your co-operation.


Parmod Saini




robin tyagi

unread,
Apr 7, 2011, 8:22:03 AM4/7/11
to redhathcl...@googlegroups.com
Dear sir,

I have install DNS Server and on public IP it resolve Name to IP address and IP to name as per below mention :- 1 to 4 log 

And when i try my local DNS server Name to IP Address its also working fine as per 5and 6 log

but when i try to resolve IP address to name its giving error as per below mention :-  7 and 8 log 


1 ) log
[root@mail named]# host mail.cellnext.com
     mail.cellnext.com has address 203.212.64.2

2 ) log 
[root@mail named]# host 203.212.64.2
    2.64.212.203.in-addr.arpa domain name pointer mail.cellnext.com.

3 ) log
[root@mail named]# dig www.google.com
 
 ; <<>> DiG 9.3.3rc2 <<>> www.google.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52050
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 4, ADDITIONAL: 0
 
;; QUESTION SECTION:
;www.google.com.                        IN      A
 
;; ANSWER SECTION:
www.google.com.         604800  IN      CNAME   www.l.google.com.
www.l.google.com.       300     IN      CNAME   www-notmumbai.l.google.com.
www-notmumbai.l.google.com. 300 IN      A       74.125.71.99
www-notmumbai.l.google.com. 300 IN      A       74.125.71.103
www-notmumbai.l.google.com. 300 IN      A       74.125.71.104
www-notmumbai.l.google.com. 300 IN      A       74.125.71.105
www-notmumbai.l.google.com. 300 IN      A       74.125.71.106
www-notmumbai.l.google.com. 300 IN      A       74.125.71.147
 
;; AUTHORITY SECTION:
google.com.             172799  IN      NS      ns1.google.com.
google.com.             172799  IN      NS      ns2.google.com.
google.com.             172799  IN      NS      ns3.google.com.
google.com.             172799  IN      NS      ns4.google.com.
 
;; Query time: 2633 msec
;; SERVER: 192.168.0.233#53(192.168.0.233)
;; WHEN: Thu Apr  7 16:56:34 2011
;; MSG SIZE  rcvd: 248


4 ) log

[root@mail named]# dig -x 74.125.71.147
 
; <<>> DiG 9.3.3rc2 <<>> -x 74.125.71.147
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16078
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0
 
;; QUESTION SECTION:
;147.71.125.74.in-addr.arpa.    IN      PTR
 
;; ANSWER SECTION:
147.71.125.74.in-addr.arpa. 86400 IN    PTR     hx-in-f147.1e100.net.
 
;; AUTHORITY SECTION:
125.74.in-addr.arpa.    86400   IN      NS      NS4.GOOGLE.COM.
125.74.in-addr.arpa.    86400   IN      NS      NS1.GOOGLE.COM.
125.74.in-addr.arpa.    86400   IN      NS      NS2.GOOGLE.COM.
125.74.in-addr.arpa.    86400   IN      NS      NS3.GOOGLE.COM.
 
;; Query time: 826 msec
;; SERVER: 192.168.0.233#53(192.168.0.233)
 ;; WHEN: Thu Apr  7 16:57:41 2011
;; MSG SIZE  rcvd: 160


5 )  log
[root@mail named]# host mail.netopscn.com
      mail.netopscn.com has address 192.168.0.233

6 )  log
[root@mail named]# dig mail.netopscn.com
 
; <<>> DiG 9.3.3rc2 <<>> mail.netopscn.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37240
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
 
;; QUESTION SECTION:
;mail.netopscn.com.             IN      A
 
;; ANSWER SECTION:
mail.netopscn.com.      86400   IN      A       192.168.0.233
 
;; AUTHORITY SECTION:
netopscn.com.           86400   IN      NS      mail.netopscn.com.
 
;; Query time: 13 msec
;; SERVER: 192.168.0.233#53(192.168.0.233)
;; WHEN: Thu Apr  7 16:55:52 2011
;; MSG SIZE  rcvd: 65


7 ) log
[root@mail named]# dig -x 192.168.0.233
 
; <<>> DiG 9.3.3rc2 <<>> -x 192.168.0.233
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 42583
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
 
;; QUESTION SECTION:
;233.0.168.192.in-addr.arpa.    IN      PTR
 
;; AUTHORITY SECTION:
0.168.192.in-addr.arpa. 86400   IN      SOA     mail.netopscn.com. root.mail.netopscn.com. 1997022700 28800 14400 3600000 86400
 
;; Query time: 16 msec
;; SERVER: 192.168.0.233#53(192.168.0.233)
;; WHEN: Thu Apr  7 16:55:25 2011
;; MSG SIZE  rcvd: 102


8 ) log
[root@mail named]# host 192.168.0.233
     Host 233.0.168.192.in-addr.arpa not found: 3(NXDOMAIN)



Regards,
Robin Tyagi

robin tyagi

unread,
Apr 7, 2011, 9:02:02 AM4/7/11
to redhathcl...@googlegroups.com
Dear sir,

I have found issue and now issue is resolved.


Regards,
Robin Tyagi 
Reply all
Reply to author
Forward
0 new messages