Wednesday, May 22, 2013

Configuring DNS/Bind Server on RedHat 6



nano /etc/hosts


192.168.0.101 www.sourav.com
192.168.0.101 www.test.com
192.168.0.101 redhatserver.sourav.com
192.168.0.101 redhatserver.test.com
nano /etc/resolv.conf

search sourav.com

nano /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
HWADDR="00:0C:29:46:0C:5A"
NM_CONTROLLED="no"
BOOTPROTO="STATIC"
ONBOOT="yes"
IPADDR=192.168.0.101
NETMASK=255.255.255.0
BROADCAST=192.168.0.255
NETWORK=192.168.0.0
GATEWAY=192.168.0.201
DNS1=192.168.0.101
DOMAIN=sourav.com

emacs /etc/named.conf


options {
# make it comment ( listen all interfaces on the server )
#listen-on port 53 { 127.0.0.1; };
#change ( if not use IPv6 )
listen-on-v6 { none; };
directory "/var/named";
forwarders { 8.8.8.8;4.2.2.2; };
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";
# query range ( set internal server and so on )
allow-query {
localhost;
192.168.0.0/24;
};
# transfer range ( set it if you have secondary DNS )
#allow-transfer { localhost; 192.168.0.0/24; };
recursion yes;
dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file "/etc/named.iscdlv.key";
managed-keys-directory "/var/named/dynamic";
};

logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

# change all from here

view "internal" {
        match-clients {
                localhost;
                192.168.0.0/24;
        };
        zone "." IN {
                type hint;
                file "named.ca";
        };
        zone "sourav.com" IN {
                type master;
                file "sourav.com.fwd";
                allow-update { none; };
        };
        zone "0.0.10.in-addr.arpa" IN {
                type master;
                file "0.168.192.rev";
                allow-update { none; };
        };
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
};




nano /var/named/sourav.com.fwd



$TTL 86400
@   IN  SOA     redhatserver.sourav.com. root.sourav.com. (
        2013051001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)



    IN         NS        redhatserver.sourav.com.


    IN         A         192.168.0.101



    IN       MX    10      redhatserver.sourav.com.



redhatserver       IN      A          192.168.0.101


emacs /var/named/0.168.192.rev


$TTL 86400
@   IN  SOA     redhatserver.sourav.com. root.sourav.com. (
        2013051001  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)



     IN      NS        redhatserver.sourav.com.



     IN      PTR       sourav.com.
     IN       A       255.255.255.0



    101        IN      PTR       redhatserver.sourav.com.




/etc/rc.d/init.d/named restart

No comments:

Post a Comment