Saturday, December 15, 2018

DNS Service

DNS configuration on CENTOS 7

Configure a host name

# vi /etc/sysconfig/network

--------------------------------
# Created by anaconda
NETWORKING=yes
GATEWAY=192.168.0.185
HOSTNAME=sajed.com
--------------------------------
# vi /etc/hosts
--------------------------------
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.185  ns1.sajed.com ns1
--------------------------------

# yum install bind* -y
# vi /etc/named.conf

options {
        listen-on port 53 { 127.0.0.1; 192.168.0.185;};
        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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
        allow-query     { localhost; 192.168.0.1/24;};
        /*


zone "sajed.com" IN {
        type master;
        file "fwd.sajed";
        allow-update {none;};
};

zone "0.168.192.in-addr.arpa" IN {
        type master;
        file "rev.sajed";
        allow-update {none;};
};


# vi /var/named/fwd.sajed

Forward zone file
---------------------------------------------------
$TTL 86400
@    IN   SOA  ns1.sajed.com. root.sajed.com. (
2011071001     ; Serial
          3600           ; Refresh
          1800           ; Retry
          604800         ; Expire
          86400          ; Minimum TTL
)
@    IN   NS   ns1.sajed.com. ; in the domain
@    IN   A    192.168.0.185 ; external to domain
ns1  IN   A    192.168.0.185  ; name server definition    

# vi /var/named/rev.sajed

Reverse zone file
---------------------------------------------------
$TTL 86400
@    IN   SOA  ns1.sajed.com. root.sajed.com. (
2011071001     ; Serial
          3600           ; Refresh
          1800           ; Retry
          604800         ; Expire
          86400          ; Minimum TTL
)
@    IN   NS   ns1.sajed.com. ; In the domain
ns1  IN   A    192.168.0.185  ; Name server definition
185  IN   PTR  ns1.sajed.com  ; Revers zone


# systemctl start named.service
# firewall-cmd --permanent --add-port=53/tcp
# firewall-cmd --permanent --add-port=53/udp
# firewall-cmd --reload
# named-checkconf /etc/named.conf
# named-checkzone sajed.com /var/named/fwd.sajed
# named-checkzone sajed.com /var/named/rev.sajed

# nslookup sajed.com

No comments:

Post a Comment

Posts

test

Dear All, Today is my last day in the office. As I wrap up my time here, I express my deepest gratitude for the opportunity to work with suc...