Friday, September 6, 2013

How to create a dns server

  How to Create a dns server


Dear Viewer: I'm trying to shortly some command how to create a dns server. Only some steps you follows, you will be create a dns server. dns server is mandatory mail server, web server, yum server and many more. Lets start..

Package Name: bind, bind-chroot
Daemon: named
Port: 63
Install: yum install bind* -y
Configuration file: /etc/named.conf
                          /etc/named.rfc1912.zones


[root@server10 named]# yum install bind* -y
[root@server10 named]# 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.110; }; [input your dns server ip]
        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; }; [who will be allow your dns server]
        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;
        };
};

zone "." IN {
        type hint;
        file "named.ca";
};

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



[root@server10 named]# vim /etc/named.rfc1912.zones
// 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 "localhost.localdomain" IN {
        type master;
        file "named.localhost";
        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 "1.0.0.127.in-addr.arpa" IN {
        type master;
        file "named.loopback";
        allow-update { none; };
};

zone "0.in-addr.arpa" IN {
        type master;
        file "named.empty";
        allow-update { none; };
};

zone "example.com" IN {
        type master;
        file "example.fz";
        allow-update { none; };
};
zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "example.rz";
        allow-update { none; };
};



[root@server10 named]# cd /var/named

[root@server10 named]# cp named.localhost example.fz

[root@server10 named]# cp named.loopback example.rz

[root@server10 named]# chgrp named example.fz

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                     0       ; serial
                                     1D      ; refresh
                                     1H      ; retry
                                     1W      ; expire
                                     3H )    ; minimum
        IN      NS      dns.example.com.
        IN      A       192.168.0.110
dns     IN      A       192.168.0.110



[root@server10 named]# chgrp named example.rz

$TTL 1D
@       IN SOA  @ rname.invalid. (
                                     0       ; serial
                                     1D      ; refresh
                                     1H      ; retry
                                     1W      ; expire
                                     3H )    ; minimum
        IN      NS      dns.example.com.
        IN      A       192.168.0.110
110     IN      PTR     dns.example.com.


[root@server10 named]# vim /etc/hosts

127.0.0.1       localhost.localdomain   localhost.localdomain   localhost4      localhost4.localdomain4 localhost       dns
::1     localhost.localdomain   localhost.localdomain   localhost6      localhost6.localdomain6 localhost       dns

192.168.0.110   dns.example.com dns

[root@server10 named]# vim /etc/sysconfig/network [check]

[root@server10 named]# vim /etc/resolv.conf [check]

[root@server10 named]# service named restart

[root@server10 named]# chkconfig named on

[root@server10 named]# nslookup
>dns.example.com

[root@server10 named]# dig dns.example.com

[root@server10 named]# dig -x 192.168.0.110

[root@server10 named]# named-checkzone example.fz /var/named/example.fz

[root@server10 named]# named-checkzone example.rz /var/named/example.rz


====================thanks==================

1 comment:

  1. I want to learn linux. but don know how to learn.

    http://malekbd.blogspot.com/

    ReplyDelete