{"id":144,"date":"2011-03-17T08:33:55","date_gmt":"2011-03-17T03:33:55","guid":{"rendered":"http:\/\/linuxndme.com\/?p=144"},"modified":"2011-03-17T08:33:55","modified_gmt":"2011-03-17T03:33:55","slug":"external-dns-cache-and-resolver-using-djbdns","status":"publish","type":"post","link":"https:\/\/blog.nixwind.com\/?p=144","title":{"rendered":"External DNS cache and resolver using djbdns"},"content":{"rendered":"<p><strong>Overview<\/strong><\/p>\n<p>A howto on building a DNS caching and Resolving server with dnscache. This server will resolve and cache DNS requests from root servers for other networks\/machines.<\/p>\n<p>Scenario : For example all machines of network 10.20.x.x will be using this server with IP 192.168.2.1 for DNS resolution.<\/p>\n<p><strong>Requirements <\/strong><\/p>\n<ul>\n<li>Centos server ( any other Linux\/Unix distro can be used )<\/li>\n<li> Atleast 1 configured public IP address :: Let it be 192.168.2.1 ( you need to do configure a proper IP )<\/li>\n<\/ul>\n<p><strong>Installation<\/strong><\/p>\n<p>daemontools must be installed for monitoring and supervising dnscache<\/p>\n<p><strong>Step 1<\/strong><\/p>\n<p>Install daemontools<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> yum install make gcc <\/strong><\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/src <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/www.qmail.org\/moni.csi.hu\/pub\/glibc-2.3.1\/daemontools-0.76.errno.patch <\/strong><\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> mkdir -p \/package <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> chmod 1755 \/package <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/package <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget\u00a0 http:\/\/cr.yp.to\/daemontools\/daemontools-0.76.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -zxvf daemontools-0.76.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> rm daemontools-0.76.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd admin\/daemontools-0.76 <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> patch -p1 &lt; \/usr\/src\/daemontools-0.76.errno.patch <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> package\/install <\/strong><\/p>\n<p><strong>Step 2<\/strong><\/p>\n<p>Install djbdns package<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> cd \/usr\/src\/ <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> wget http:\/\/cr.yp.to\/djbdns\/djbdns-1.05.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> tar -xf djbdns-1.05.tar.gz <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~#<\/span> cd djbdns-1.05 <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> echo gcc -O2 -include \/usr\/include\/errno.h &gt; conf-cc <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> make setup check <\/strong><\/p>\n<p><strong>Configuration<\/strong><\/p>\n<p>You need to configure dnscache to listen to the IP configured on your server so that external machines can use it as resolver IP<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> useradd dnslog <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> useradd dnscache <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> dnscache-conf dnscache dnslog \/etc\/dnscache 192.168.2.1 <\/strong><\/p>\n<p>Add it to svscan to keep the service under monitoring<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> ln -s \/etc\/dnscache \/service\/dnscache <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> svc -d \/service\/dnscache <\/strong><br \/>\n<strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> svc -u \/service\/dnscache <\/strong><\/p>\n<p>Authorize the external network that want to use the server as a DNS resolver ( as an example\u00a0 10.20.x.x )<\/p>\n<p><strong><span style=\"color: #3ea99f;\">root@serv:~# <\/span> touch \/etc\/dnscache\/root\/ip\/10.20 <\/strong><\/p>\n<p><strong>Client Configuration<\/strong><\/p>\n<p>You will be able to use the IP 192.168.2.1 as DNS nameserver on all machine of network 10.20.x.x<\/p>\n<p><strong>Log file<\/strong><\/p>\n<p>\/service\/dnscache\/log\/main\/current<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview A howto on building a DNS caching and Resolving server with dnscache. This server will resolve and cache DNS requests from root servers for other networks\/machines. Scenario : For example all machines of network 10.20.x.x will be using this server with IP 192.168.2.1 for DNS resolution. Requirements Centos server ( any other Linux\/Unix distro [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66],"tags":[67,68],"_links":{"self":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/posts\/144"}],"collection":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=144"}],"version-history":[{"count":0,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=\/wp\/v2\/posts\/144\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=144"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=144"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.nixwind.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}