{"id":391,"date":"2018-07-06T00:50:22","date_gmt":"2018-07-06T00:50:22","guid":{"rendered":"http:\/\/linuxresellerwebhosting.in\/blog\/?p=391"},"modified":"2018-07-17T01:00:26","modified_gmt":"2018-07-17T01:00:26","slug":"easy-ways-to-configure-dns-on-cent-os-7","status":"publish","type":"post","link":"https:\/\/linuxresellerwebhosting.in\/blog\/easy-ways-to-configure-dns-on-cent-os-7\/","title":{"rendered":"Easy Ways to Configure DNS on Cent OS 7"},"content":{"rendered":"<p><strong>What is DNS ? <\/strong><\/p>\n<p>The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities.<\/p>\n<p>Most importantly, it translates domain names meaningful to humans into the numerical identifiers associated with networking equipment for the purpose of locating and addressing these devices worldwide.<\/p>\n<p><strong>Install BIND package :<\/strong><\/p>\n<p>BIND stands for Berkeley Internet Name Domain, a software which provides an ability to perform name to ip conversion.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \"># yum -y install bind bind-utils<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Configure BIND :<\/strong><\/p>\n<p>Configuration file of bind is \/etc\/named.conf, open up \/etc\/named.conf file. Comment out the following line, and this will enable BIND to listen on all ip addresses.<\/p>\n<p>#listen-on port 53 { 127.0.0.1; };<br \/>\n#listen-on-v6 port 53 { ::1; };<\/p>\n<p>If you want to build public DNS server, then change the line like below<\/p>\n<p>allow-query { any; };<\/p>\n<p><strong>Create Zones :<\/strong><\/p>\n<p>The following is the forward zone entry in named.conf file, written for the darzilla.com domain. Edit \/etc\/named.conf.<\/p>\n<p># vi \/etc\/named.conf<\/p>\n<p>zone &#8220;darzilla.com&#8221; IN {<br \/>\ntype master;<br \/>\nfile &#8220;fwd.darzilla.db&#8221;;<br \/>\nallow-update { none; };<br \/>\n};<\/p>\n<p>Here<\/p>\n<p>darzilla.com\u2013 Domain name<br \/>\nmaster \u2013 Primary DNS<br \/>\nfwd.darzilla.db \u2013 Forward lookup file<br \/>\nallow-update \u2013 Since this is the primary DNS, it should be none<\/p>\n<p><strong>Create Zone Files :<\/strong><\/p>\n<p>Now, it\u2019s the time to create a lookup file for a created zone. By default, zone lookup files are placed under \/var\/named directory. Create a zone file called fwd.itzgeek.local.db for forward lookup under \/var\/named directory. All domain names should end with a dot (.).<\/p>\n<p>There are some special keywords for Zone Files<\/p>\n<p>A \u2013 A record<br \/>\nNS \u2013 Name Server<br \/>\nMX \u2013 Mail for Exchange<br \/>\nCNAME \u2013 Canonical Name<\/p>\n<p>E \u2013 Canonical Name<\/p>\n<p>$TTL 14400<br \/>\ndarzilla.com. 86400 IN SOA ns1.darzilla.com. admin.darzilla.com. (<br \/>\n2018052401 ;Serial Number<br \/>\n3600 ;refresh<br \/>\n7200 ;retry<br \/>\n1209600 ;expire<br \/>\n86400 )<\/p>\n<p>darzilla.com. 86400 IN NS ns1.darzilla.com.<br \/>\ndarzilla.com. 86400 IN NS ns2.darzilla.com.<\/p>\n<p>darzilla.com. 14400 IN A 103.14.121.87<\/p>\n<p>ns1.darzilla.com. 14400 IN A 103.14.121.87<br \/>\nns2.darzilla.com. 14400 IN A 103.14.121.87<\/p>\n<p>darzilla.com. 14400 IN MX 0 darzilla.com.<\/p>\n<p>mail 14400 IN CNAME darzilla.com.<br \/>\nwww 14400 IN CNAME darzilla.com.<br \/>\nftp 14400 IN A 103.14.121.87<\/p>\n<p>Once zone files are created, restart bind service.<\/p>\n<pre class=\"\"># systemctl restart named.service<\/pre>\n<p>Enable it on system startup.<\/p>\n<pre class=\"\"># systemctl enable named.service<\/pre>\n<h2>Verify zones<\/h2>\n<p>Visit any client machine and <strong>add a <\/strong>DNS<strong> server ip address in \/etc\/resolv.conf if Network Manager does not manage the network<\/strong>.<\/p>\n<pre class=\"\"># vi \/etc\/resolv.conf\r\n\r\nnameserver YourserverIP<\/pre>\n<p><strong>If Network Manager manages the networking then place the following entry in \/etc\/sysconfig\/network-scripts\/ifcfg-eXX file.<\/strong><\/p>\n<pre class=\"\">DNS1=YourserverIP<\/pre>\n<p>Restart network service.<\/p>\n<pre class=\"\"># systemctl restart NetworkManager.service<\/pre>\n<p>Restart network service.<\/p>\n<p>&nbsp;<\/p>\n<p>Thanks for reading this blog, hope It will be helpful for you \ud83d\ude42<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is DNS ? The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[1],"tags":[],"class_list":["post-391","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=391"}],"version-history":[{"count":6,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/391\/revisions"}],"predecessor-version":[{"id":406,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/391\/revisions\/406"}],"wp:attachment":[{"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxresellerwebhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}