{"id":228,"date":"2015-07-06T11:08:34","date_gmt":"2015-07-06T11:08:34","guid":{"rendered":"http:\/\/www.howtolearnlinux.com\/?p=228"},"modified":"2018-12-22T06:22:25","modified_gmt":"2018-12-22T06:22:25","slug":"bind-dns-service","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=228","title":{"rendered":"Bind DNS Service"},"content":{"rendered":"<p align=\"justify\">DNS is a structured database system that maps a computer&#8217;s fully qualified domain name into an IP address.<\/p>\n<p align=\"justify\">Computers in a network use IP addresses to locate and connect to each other, but IP addresses is not easy for people to remember. For example, on the web, it&#8217;s much easier for people to remember the www.genuinewebhosting.net than it is to remember its IP address (20.20.20.3).<\/p>\n<p align=\"justify\">Reverse DNS (rDNS) does the opposite. It translates IP addresses to a domain name.<\/p>\n<h3 align=\"center\">How to identify a network device<\/h3>\n<p align=\"left\">A node or computer in a network can be identified by<\/p>\n<ul>\n<li>\n<div align=\"left\">MAC address : This is a permanent hex number punched in the NIC.<\/div>\n<\/li>\n<li>\n<div align=\"left\">IP address: Assigned by a network administrator, used in LAN using TCP\/IP protocol<\/div>\n<\/li>\n<li>\n<div align=\"left\">Domain name: such as genuinewebhosting.net, yahoo.com. etc<\/div>\n<\/li>\n<\/ul>\n<div align=\"center\">\n<h3 align=\"center\">How systems communicate in a network<\/h3>\n<p align=\"left\">In this example the computer-A is trying to view the site using the URL http:\/\/mycomp.com<\/p>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/star.genuinewebhost.com\/%7Elinuxguru\/www\/images\/dns2.jpg\" alt=\"\" width=\"336\" height=\"229\" \/><\/p>\n<p align=\"center\">The host &#8216;A&#8217; contacts the DNS server to find the IP for &#8216;mycomp.com&#8217;, gets it from the DNS, and then contact the IP address for the web page.<\/p>\n<h3 align=\"center\">DNS Structure<\/h3>\n<p align=\"center\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/star.genuinewebhost.com\/%7Elinuxguru\/www\/images\/dns1.jpg\" alt=\"\" width=\"412\" height=\"140\" border=\"0\" \/><\/p>\n<h3 align=\"center\">The Internet Corporation for Assigned Names and Number<\/h3>\n<p align=\"justify\">The ICANN manages the DNS root of the Internet domain namespace. It\u2019s role is to manage the assignment of identifiers, and to ensuring that all users have unique names.<\/p>\n<h3 align=\"center\">DNS settings in client hosts<\/h3>\n<\/div>\n<p>In the client system, the IP address of a default DNS server has to be provided<\/p>\n<ul>\n<li>\n<div align=\"justify\">In a <strong>linux<\/strong> hosts the initial resolver is configured using the file<em> \/etc\/resolve.conf<\/em><\/div>\n<\/li>\n<li>\n<div align=\"justify\">In <strong>windows<\/strong> the default DNS server is configured in the <em>TCP\/IP<\/em> settings<\/div>\n<\/li>\n<\/ul>\n<div align=\"center\">\n<h3 align=\"center\">Types of Records in a DNS database<\/h3>\n<p align=\"left\">Types on entries\/records used in a DNS database are as follows:<\/p>\n<\/div>\n<ul>\n<li>\n<div align=\"justify\">A record: Used to point a domain name to an IP address<\/div>\n<\/li>\n<li>\n<div align=\"justify\">PTR record: Used to point an IP to a domain name<\/div>\n<\/li>\n<li>\n<div align=\"justify\">CNAME record: Used to point a domain name to another domain name<\/div>\n<\/li>\n<li>\n<div align=\"justify\">MX record: Used to point to a mail server&#8217;s IP<\/div>\n<\/li>\n<li>\n<div align=\"justify\">NS record: Points to its Name Server<\/div>\n<\/li>\n<\/ul>\n<h3 align=\"center\">Installing BIND DNS<\/h3>\n<p>Rpms that are required to install BIND DNS are:<br \/>\n1. Bind-9_ _ _.rpm<br \/>\n2. Caching_nameserver_ _ _.rpm<br \/>\n3. bind_utils_ _ _.rpm<\/p>\n<p><strong>Configuration file :<\/strong> \/etc\/named.conf<br \/>\n<strong>Demon :<\/strong> named<\/p>\n<h3 align=\"center\">Where are the named log?<\/h3>\n<p>Transaction of BIND DNS by default are logged in \/var\/log\/messages<br \/>\nDetail logging can be enabled using the rndc utility.<br \/>\n# rndc querylog : This command is used to enable\/disable detail logs.<br \/>\n# service named status : This will output the status of logging too.<\/p>\n<h3 align=\"center\">Creating a simple \/etc\/named.conf<\/h3>\n<p># vi \/etc\/named.conf<\/p>\n<p>options {<br \/>\ndirectory &#8220;\/var\/named&#8221;;<br \/>\n};<\/p>\n<p>zone &#8220;mycomp.com&#8221; {<br \/>\ntype master;<br \/>\nfile &#8220;mycomp_forward&#8221;;<br \/>\n};<\/p>\n<p>zone &#8220;0.168.192.in-addr.arpa&#8221; {<br \/>\ntype master;<br \/>\nfile &#8220;mycomp_reverse&#8221;;<br \/>\n};<\/p>\n<h3 align=\"center\">Check for syntax errors in named.conf<\/h3>\n<p>The command <strong><em>named-checkconf \/etc\/named.conf <\/em><\/strong>with check for any syntax errors.<br \/>\nAny error caught will be displayed. Else will return to prompt<\/p>\n<h3 align=\"center\">How to create a forward database<\/h3>\n<p>The file <strong><em>localdomain.zone<\/em><\/strong> can be used as a template. Below listed templates are availanle if caching_nameserver is installed<\/p>\n<p># cd \/var\/named\/<br \/>\n# cp localdomain.zone mycomp_forward<br \/>\n# vi mycomp_forward<br \/>\nAdd the following line:<br \/>\nsample.mycomp.com<span style=\"color: #000066; font-size: small;\"><strong>.<\/strong><\/span> \u00a0 IN \u00a0 A \u00a0 192.168.0.2<\/p>\n<h3 align=\"center\">How to create a reverse DNS database<\/h3>\n<p># cd \/var\/named\/<br \/>\n# cp named.local mycomp_reverse<br \/>\n# vi mycomp_reverse<br \/>\nAdd the following line:<br \/>\n2 \u00a0 IN \u00a0 PTR \u00a0 sample.mycomp.com<strong><span style=\"color: #000099; font-size: small;\">.<\/span><\/strong><\/p>\n<h3 align=\"center\">How to check for syntax errors in database<\/h3>\n<p>The command named-checkzone can be used<\/p>\n<p>#] named-checkzone mycomp.com \/var\/named\/mycomp_forward<br \/>\nzone mycomp.com\/IN: loaded serial 42<br \/>\nOK<br \/>\n#]<\/p>\n<ul>\n<li>Any error caught will be displayed.<\/li>\n<li>Else will return to prompt with the serial number.<\/li>\n<\/ul>\n<h3 align=\"center\">DNS: Master\/Slave<\/h3>\n<p>Here one DNS server will work as the master. All updates will be made in master DNS<br \/>\nSlave DNS pulls info from master frequently.<\/p>\n<h3 align=\"center\">How to configure a slave DNS<\/h3>\n<p>The configuration file <em><strong>\/etc\/named.conf<\/strong><\/em> of a simple slave DNS server:<\/p>\n<p>options {<br \/>\ndirectory &#8220;\/var\/named&#8221; ;<br \/>\n};<\/p>\n<p>zone &#8220;mycomp.com&#8221; {<br \/>\ntype slave ;<br \/>\nfile &#8220;mycomp_forward&#8221; ;<br \/>\nmasters {10.146.179.68; } ;<br \/>\n};<\/p>\n<p>Once you start the DNS server this slave host will contact the master (10.146.179.68) and make a copy of sample_forward file the local host. So if this file appears in the slave host, it shows the transfer happened correctly.<\/p>\n<h3 align=\"center\">Reasons why slave DNS cannot update its database from the master server<\/h3>\n<ul>\n<li>Check for an entry allow-transfer in the named.conf file in the master DNS server<\/li>\n<li>Ensure the named.conf files, and the folder \/var\/named is owned by the user and group named.<\/li>\n<li>The SELINUX \/ Iptables could create issues.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>DNS is a structured database system that maps a computer&#8217;s fully qualified domain name into an IP address. Computers in a network use IP addresses <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=228\" title=\"Bind DNS Service\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":430,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,3],"tags":[],"class_list":["post-228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dns","category-linux"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=228"}],"version-history":[{"count":2,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions"}],"predecessor-version":[{"id":747,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/228\/revisions\/747"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/430"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=228"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}