{"id":1684,"date":"2012-11-07T15:14:41","date_gmt":"2012-11-07T07:14:41","guid":{"rendered":"http:\/\/rmohan.com\/?p=1684"},"modified":"2012-11-07T15:15:14","modified_gmt":"2012-11-07T07:15:14","slug":"djbdns-dns-server-on-centos","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1684","title":{"rendered":"DjbDNS DNS Server On CentOS"},"content":{"rendered":"<p>\u00a0djbDNS DNS Server On CentOS<\/p>\n<p>What is djbDNS? And why do we use djbDNS? There is a new point of view to serve the dns service &#8211; each of the dns server functionalities is a separate service, like authority, cache, forward and so on.<\/p>\n<p>The other difference is the daemon-tools which will rapidly restart services to prevent zombies.<\/p>\n<p>Log in as root.<\/p>\n<p># yum update<\/p>\n<p># yum install gcc<\/p>\n<p># mkdir pkg<\/p>\n<p># cd pkg<\/p>\n<p>The first step is to install the daemon-tools:<\/p>\n<p># cd ~\/pkg<\/p>\n<p># wget http:\/\/cr.yp.to\/daemontools\/daemontools-0.76.tar.gz<\/p>\n<p># gunzip daemontools-0.76.tar<\/p>\n<p># tar -xpf daemontools-0.76.tar<\/p>\n<p># rm -f daemontools-0.76.tar<\/p>\n<p># cd admin\/daemontools-0.76<\/p>\n<p># vi src\/conf-cc<\/p>\n<p>Append the following line at the end of the gcc line:<\/p>\n<p>-include \/usr\/include\/errno.h<br \/># .\/package\/install<\/p>\n<p>One other package we need to prepare for djbdns to be functional is ucspi:<\/p>\n<p># cd ~\/pkg<\/p>\n<p># wget http:\/\/cr.yp.to\/ucspi-tcp\/ucspi-tcp-0.88.tar.gz<\/p>\n<p># gunzip ucspi-tcp-0.88.tar<\/p>\n<p># tar -xf ucspi-tcp-0.88.tar<\/p>\n<p># cd ucspi-tcp-0.88<\/p>\n<p># vi src\/conf-cc<\/p>\n<p>Append the following line at the end of the gcc line:<\/p>\n<p>-include \/usr\/include\/errno.h<br \/># make<\/p>\n<p># make setup check<\/p>\n<p>The next step is the document publication:<\/p>\n<p># cd ~\/pkg<\/p>\n<p># wget http:\/\/cr.yp.to\/djbdns\/doc.tar.gz<\/p>\n<p>Next we will unzip docs under \/doc:<\/p>\n<p># gunzip &lt; doc.tar.gz | (cd \/; tar -xf -)<\/p>\n<p>Use the following script to merge in system docs:<\/p>\n<p>#!\/bin\/sh<br \/>for i in packages commands cfunctions fileformats<br \/>do<br \/>\u00a0 sort -f \/dev\/null `find \/doc\/merge -name $i.html` &gt; \/doc\/$i.new<br \/>\u00a0 mv \/doc\/$i.new \/doc\/$i.html<br \/>done<\/p>\n<p>Save script into a file: script.sh<\/p>\n<p># chmod +x script.sh<\/p>\n<p># .\/script.sh<\/p>\n<p># cd ~\/pkg<\/p>\n<p># wget http:\/\/cr.yp.to\/djbdns\/djbdns-1.05.tar.gz<\/p>\n<p># gunzip djbdns-1.05.tar<\/p>\n<p>\u00a0tar -xf djbdns-1.05.tar<\/p>\n<p># cd djbdns-1.05<\/p>\n<p># vi src\/conf-cc<\/p>\n<p>Append the following line at the end of the gcc line:<\/p>\n<p>-include \/usr\/include\/errno.h<\/p>\n<p># make<\/p>\n<p># make setup check<\/p>\n<p>All compiling gets done.<\/p>\n<p>The next step is the dns server configuration.<\/p>\n<p>&nbsp;<\/p>\n<p>DNSCACHE<br \/>Create two system user accounts:<\/p>\n<p># useradd -d \/var\/dnscache -s \/bin\/false dnscache<\/p>\n<p># useradd -d \/var\/dnscache -s \/bin\/false dnslog<\/p>\n<p>Configure the cache:<\/p>\n<p># dnscache-conf dnscache dnslog \/var\/dnscache\/dnscache &lt;listen-IP&gt;<\/p>\n<p>Example: dnscache-conf dnscache dnslog \/var\/dnscache\/dnscache 192.168.20.1<\/p>\n<p>Allow the rest of your network to query dnscache:<\/p>\n<p># touch \/var\/dnscache\/dnscache\/root\/ip\/&lt;Net-ID&gt;<\/p>\n<p>Example: touch \/var\/dnscache\/dnscache\/root\/ip\/192.168<\/p>\n<p>Add dnscache to the list of services to be monitored by svscan:<\/p>\n<p># ln -sf \/var\/dnscache\/dnscache \/service\/<\/p>\n<p>If you like ms-windows&#8230; you can make a reboot to be sure that all the world is in place.<\/p>\n<p>There is a point here that your are still not able to query from your cache server, because your clients are now able to be resolved in reverse mode.<\/p>\n<p>As mentioned before it&#8217;s one of the dns-cache security features to reverse-check clients. So in the next step we will work on tinydns to act for us.<\/p>\n<p>&nbsp;<\/p>\n<p>DNSTINY<br \/>Once again, we need two system user accounts:<\/p>\n<p># useradd -d \/var\/dnscache -s \/bin\/false tinydns<\/p>\n<p># useradd -d \/var\/dnscache -s \/bin\/false tinylog<\/p>\n<p># tinydns-conf tinydns tinylog \/var\/dnscache\/tinydns 127.0.0.1<\/p>\n<p>Now it&#8217;s time to add nodes into dns database:<\/p>\n<p># cd \/var\/dnscache\/tinydns\/root<\/p>\n<p># .\/add-ns rmohan.com 192.168.2.1<\/p>\n<p># .\/add-ns 2.168.192.in-addr.arpa 192.168.2.1<\/p>\n<p># .\/add-mx rmohan.com 192.168.2.2<\/p>\n<p># .\/add-host ns1.rmohan.com 192.168.2.1<\/p>\n<p># .\/add-host mail.rmohan.com 192.168.2.2<\/p>\n<p># .\/add-alias test.rmohan.com 192.168.2.2<\/p>\n<p># make<\/p>\n<p>These nodes with go to the database file \/var\/dnscache\/tinydns\/root\/data that you are able to edit manually.<\/p>\n<p>The last step is the dns service startup:<\/p>\n<p># ln -sf \/var\/dnscache\/tinydns \/service<\/p>\n","protected":false},"excerpt":{"rendered":"<p> djbDNS DNS Server On CentOS<\/p>\n<p>What is djbDNS? And why do we use djbDNS? There is a new point of view to serve the dns service &#8211; each of the dns server functionalities is a separate service, like authority, cache, forward and so on.<\/p>\n<p>The other difference is the daemon-tools which will rapidly restart [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1684"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1684"}],"version-history":[{"count":3,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1684\/revisions"}],"predecessor-version":[{"id":1688,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1684\/revisions\/1688"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1684"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1684"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1684"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}