Friday, October 16, 2015

DNS server centos 6

     
Today we are going to configure DNS server which resolves domain name or IP address. We are going to use the package bind for it and it uses port 53/TCP,UDP.
First we need to Install BIND.
[root@dlp ~]# yum -y install bind bind-utils
[2]     Configure BIND This example is done with grobal IP address [192.168.0.80/29], Private IP address [192.168.0.0/24], Domain name [clado.com]. However, Please use your own IPs and domain name when you set config on your server. ( Actually, [192.168.0.80/29] is for private IP address, though. )
[root@dlp ~]# echo 'OPTIONS="-4"' >> /etc/sysconfig/named
  # set if you don't use IPv6 ( if use, don't set it )
[root@dlp ~]# vi /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 {
# comment out ( listen all interfaces on the server )

#
listen-on port 53 { any; };

# change ( if not use IPv6 )

listen-on-v6 { none; };

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

# 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 "clado.com" IN {
                type master;
                file "clado.com.db";
                allow-update { none; };
        };
        zone "0.168.192.in-addr.arpa" IN {
                type master;
                file "0.168.192.db";
                allow-update { none; };
        };
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
};
view "external" {
        match-clients { any; };
        allow-query { any; };
        recursion no;
        zone "clado.com" IN {
                type master;
                file "clado.com.db";
                allow-update { none; };
        };
        zone "80.0.168.192.in-addr.arpa" IN {
                type master;
                file "80.0.168.192.db";
                allow-update { none; };
        };
};

# allow-query ⇒ query range you permit

# allow-transfer ⇒ the range you permit to transfer zone info

# recursion ⇒ allow or not to search recursively

# view "internal" { ** }; ⇒ write for internal definition

# view "external" { ** }; ⇒ write for external definition
# For How to write for reverse resolving, Write network address reversely like below.
# 192.168.0.0/24
# network address⇒ 192.168.0.0

# range of network⇒ 192.168.0.0 - 192.168.0.255

# how to write⇒ 0.168.192.in-addr.arpa
# 192.168.0.80/29
# network address⇒ 192.168.0.80

# range of network⇒ 192.168.0.80 - 172.16.0.87

# how to write⇒ 80.0.168.192.in-addr.arpa

No comments:

Post a Comment