Sunday, April 8, 2012

DNS SERVER ON RHEL 6


Lab scenario:- 
Server Ip = 192.168.0.10
Server Hostname = server.example.com
Client IP = 192.168.0.40
Client Hostname = client.example.com
1step := setting up your hostname 

 # vim /etc/host 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.0.10  server.example.com server


# vim /etc/sysconfig/network
NETWORKING=yes

HOSTNAME=server.example.com

# hostname server.example.com [press enter]
2nd step := add entry in resolve.conf file
# vim /etc/resolve.conf
# Generated by NetworkManager

search example.com

nameserver 192.168.0.10





3rd step := Install BIND package 
# yum -y install bind* 

4rth step := Edit the named.conf 
1st backup this file
# cp -avr /etc/named.conf /etc/named.conf.org
# vim /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 { 192.168.0.10; };

 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; };

 recursion yes;



 dnssec-enable yes;

 dnssec-validation no;

 dnssec-lookaside auto;



 /* Path to ISC DLV key */

 bindkeys-file "/etc/named.iscdlv.key";

};



logging {

        channel default_debug {

                file "data/named.run";

                severity dynamic;

        };

};



zone "." IN {

 type hint;

 file "named.ca";

};



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




save and quit 
5th step := Edit /etc/named.rfc1912.zones like this
// 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 http://www.ietf.org/internet-drafts/draft-ietf-dnsop-default-local-zones-02.txt

// (c)2007 R W Franks

// 

// See /usr/share/doc/bind*/sample/ for example named configuration files.

//



zone "example.com" IN {

 type master;

 file "forward.zone";

 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 "0.168.192.in-addr.arpa" IN {

 type master;

 file "reverse.zone";

 allow-update { none; };

};



zone "0.in-addr.arpa" IN {

 type master;

 file "named.empty";

 allow-update { none; };

};


Save AND Quit 





6th step := create forware.zone nad reverse.zone file in /var/named/  like this 
 # cp named.localhost forward.zone

 #  cp named.loopback reverse.zone


7th step := edit the forward and reverse.zone like this 
$TTL 1D

@ IN SOA server.example.com. root.server.example.com. (

     0 ; serial

     1D ; refresh

     1H ; retry

     1W ; expire

     3H ) ; minimum

 IN NS server.example.com.

server  IN A     192.168.0.10

 

8th step Edit the reverse.zone like this 
$TTL 1D

@ IN SOA server.example.com. root.server.example.com. (

     0 ; serial

     1D ; refresh

     1H ; retry

     1W ; expire

     3H ) ; minimum

       IN NS server.exmaple.com.

10     IN PTR server.example.com.

save file 

9th step := change the group of forward.zone and reverse.zone
 #  chgrp named forward.zone 
 #   chgrp named reverse.zone 
10th step := start the service 

# service named restart 
the test the DNS server 
# dig -x 192.168.0.10
# nslookup 192.168.0.10

5 comments:

  1. Replies
    1. Hi james thanks to visite this blogs what happend

      Delete
    2. thanks....i got lots of help with this

      Delete
  2. not working,every time i tried "service named restart" it says "/var/named/chroot/var/named... busy.and whe i tried for dig -x xxx.xxx.xxx.x it is saying that servfail and some "10.168.192.in-addr.arpa"error.

    ReplyDelete
  3. Great notes.. Please make BOLD font, where you changed in files... so new person can understand and can configure the DNS ...

    Thanks again..

    Guru Pandit - guru4om@gmail.com

    ReplyDelete