How to configure DNS server on Centos 7
Domain Name System(DNS) is a name resolution server. its basic function is translated (convert) the IP address into domain name or translated (convert) the domain name into IP address. it has a collection of domain names with mapped IP addresses
Step 1 :
Install the necessary package for DNS server configuration.
# yum update # yum install bind bind-utils
Step: 2
Configure the DNS server configuration ( /etc/named.conf).
# vim /etc/named.conf
options { listen-on port 53 { 127.0.0.1; 192.168.200.3; }; // ##### Add DNS server IP address here ######### 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.200.0/24; }; // ##### Add your network subnets here for allowing the DNS queries ###### recursion yes; dnssec-enable yes; dnssec-validation yes; /* Path to ISC DLV key */ bindkeys-file "/etc/named.iscdlv.key"; managed-keys-directory "/var/named/dynamic"; pid-file "/run/named/named.pid"; session-keyfile "/run/named/session.key"; }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; zone "." IN { type hint; file "named.ca"; }; // ########## Add below line into end of the file ############ zone "secureethics.com" IN { type master; file "/etc/named/forward.secureethics.com"; allow-update { none; }; }; zone "200.168.192.in-addr.arpa" IN { type master; file "/etc/named/reverse.secureethics.com"; allow-update { none; }; }; // ########## Add above line into end of the file ############ include "/etc/named.rfc1912.zones"; include "/etc/named.root.key";
Step: 3
Configure forward zone file (/etc/named/forward.secureethics.com)
# vim /etc/named/forward.secureethics.com
$TTL 1D @ IN SOA masterdns.secureethics.com. root.secureethics.com. ( 05152019 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS masterdns.secureethics.com. @ IN A 192.168.200.3 masterdns IN A 192.168.200.3
Step: 4
Configure forward zone file (/etc/named/reverse.secureethics.com)
# vim /etc/named/reverse.secureethics.com
$TTL 1D @ IN SOA masterdns.secureethics.com. root.secureethics.com. ( 06152019 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum @ IN NS masterdns.secureethics.com. @ IN A 192.168.200.3 masterdns IN A 192.168.200.3 3 IN PTR masterdns.secureethics.com.
Step: 5
Check the error of DNS server configuration and zone file configuration.
Check the DNS Server configuration file (named.conf)
# named-checkconf /etc/named.conf
The output should not get any error messages. if there is no error then you will get below output
Check the forward zone configuration error. if no error then you will get below ouput
# named-checkzone secureethics.com /etc/named/forward.secureethics.com
Check the reverse zone configuration error. if no error then you will get below ouput
# named-checkzone secureethics.com /etc/named/reverse.secureethics.com