Monday, October 5, 2015

Dns Server Configuration RHCE7/Centos7

1.yum install bind bind-utilsstep
 Now edit cofs.com
2: configure named.conf
options {
        listen-on port 53 { 127.0.0.1; 192.168.65.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     { localhost; 192.168.65.0/24; };

step 3: create zone file

 19 zone "tahmed.com" IN {
 20         type master;
 21         file "tahmed.com.for";
 22         allow-update { none; };
 23 };
 24
 25 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 {
 26         type master;
 27         file "named.loopback";
 28         allow-update { none; };
 29 };
 30
 31 zone "65.168.192.in-addr.arpa" IN {
 32         type master;
 33         file "tahmed.com.rev";
 34         allow-update { none; };
 35 };

[root@tahmed ~]# cp named.localhost tahmed.com.for
[root@tahmed ~]# cp named.loopback tahmed.com.rev

[root@tahmed ~]#chgrp named tahmed.com.*


step 4:Forward Zone

$TTL 1D
@       IN SOA  tahmed.tahmed.com. root.tahmed.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
         IN NS  tahmed.tahmed.com.
tahmed   IN A  192.168.65.10
www      IN CNAME tahmed.tahmed.com.
mail     IN CNAME tahmed.tahmed.com.

Reverze Zone:

$TTL 1D
@       IN SOA   tahmed.tahmed.com. root.tahmed.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        IN NS   tahmed.tahmed.com.
 10     IN PTR  tahmed.tahmed.com.

 
[root@tahmed named]# firewall-cmd --permanent --add-port=53/udp
[root@tahmed named]# firewall-cmd --permanent --add-port=53/tcp
[root@tahmed named]# firewall-cmd --permanent --add-service=dns
                                                                  
[root@tahmed named]# systemctl restart named.service
[root@tahmed named]# systemctl start named.service
[root@tahmed named]# nslookup mail.tahmed.com
Server:         192.168.65.10
Address:        192.168.65.10#53

mail.tahmed.com canonical name = tahmed.tahmed.com.
Name:   tahmed.tahmed.com
Address: 192.168.65.10


No comments:

Post a Comment