{"id":679,"date":"2013-08-05T12:14:42","date_gmt":"2013-08-05T12:14:42","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=679"},"modified":"2015-09-29T18:25:52","modified_gmt":"2015-09-29T18:25:52","slug":"bind-howto-close-an-open-dns","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=679","title":{"rendered":"BIND: HOWTO Close an Open DNS"},"content":{"rendered":"<p>BIND 9.9.7<br \/>\nBIND 9.9.5<\/p>\n<h3>Book: ZyTrax Pro DNS and BIND<\/h3>\n<p><a href=\"http:\/\/www.zytrax.com\/books\/dns\/apa\/ttl.html\">Time-to-Live (TTL) Values<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch8\/soa.html\">Start of Authority Resource Record (SOA)<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/apa\/time.html\">BIND Time formats<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch8\/aaaa.html\">IPv6 Address Record (AAAA)<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch9\/close.html\">HOWTO Close an Open DNS<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch7\/queries.html\">DNS BIND Query Statements<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch4\/\">DNS Configuration Types<\/a><br \/>\n<strong><a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch6\/\">DNS Sample BIND Configurations<\/a><\/strong><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/apa\/origin.html\">$ORIGIN, @ and blank Substitution<\/a><br \/>\n<a href=\"http:\/\/www.zytrax.com\/books\/dns\/ch7\/logging.html\">DNS BIND9 logging Clause<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n    #s = seconds = # x 1 seconds (really!)\r\n    #m = minutes = # x 60 seconds\r\n    #h = hours = # x 3600 seconds\r\n    #d = day = # x 86400 seconds\r\n    #w = week = # x 604800 seconds\r\n<\/pre>\n<h3>Problems<\/h3>\n<h4>nslookup not found in FreeBSD 10<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# pkg install bind-tools\r\n<\/pre>\n<p><a href=\"http:\/\/lists.freebsd.org\/pipermail\/freebsd-current\/2013-October\/045457.html\">May you please add alias for nslookup?<\/a><br \/>\n<a href=\"https:\/\/forums.freebsd.org\/viewtopic.php?f=4&#038;t=45143\">FreeBSD 10 sysinstall, nslookup<\/a><\/p>\n<h4>named: the working directory is not writable<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# chown -R bind:bind \/var\/named\/etc\/namedb\r\n<\/pre>\n<p><a href=\"http:\/\/lists.centos.org\/pipermail\/centos-de\/2011-October\/000913.html\">named: the working directory is not writable<\/a><\/p>\n<h4>open: \/usr\/local\/etc\/rndc.key: file not found<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# rndc-confgen -a\r\n<\/pre>\n<p><a href=\"http:\/\/bugs.centos.org\/view.php?id=5311\">Bind does not provide \/etc\/rndc.key<\/a><\/p>\n<h4>Stopping named: rndc failed, trying killall: .<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\n<\/pre>\n<p><a href=\"http:\/\/web.mit.edu\/rhel-doc\/4\/RH-DOCS\/rhel-rg-de-4\/s1-bind-rndc.html\">Die Verwendung von rndc<\/a><br \/>\n<a href=\"https:\/\/access.redhat.com\/site\/documentation\/en-US\/Red_Hat_Enterprise_Linux\/3\/html\/Reference_Guide\/s1-bind-rndc.html\">Using rndc<\/a><br \/>\n<a href=\"http:\/\/lists.freebsd.org\/pipermail\/freebsd-questions\/2007-March\/144114.html\">Stopping named: rndc failed, trying killall: .<\/a><\/p>\n<h4>rndc: &#8216;stats&#8217; failed: permission denied<\/h4>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\noptions {\r\n    dump-file       &quot;\/var\/named\/dump\/named_dump.db&quot;;\r\n    statistics-file &quot;\/var\/named\/stats\/named.stats&quot;;\r\n};\r\n<\/pre>\n<p><a href=\"http:\/\/www.linuxquestions.org\/questions\/linux-networking-3\/rndc-works-but-rndc-stats-doesnt-315367\/\">rndc works, but rndc stats doesnt<\/a><br \/>\n<a href=\"https:\/\/bugzilla.redhat.com\/show_bug.cgi?id=112350\">rndc dumpdb could not open dump file<\/a><\/p>\n<h3>Howto<\/h3>\n<p><strong>DNS-Request<\/strong><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n- autoritativ (der Server holt die Daten aus einer lokalen Zonendatei)\r\n- nicht-autoritativ\r\n  o rekursiv (der Server holt die Daten von einem anderen Nameserver)\r\n  o iterativ (der Server antwortet mit einem oder mehreren Verweisen\r\n              oder einem Resource Record auf andere Nameserver)\r\n<\/pre>\n<p><a href=\"http:\/\/de.wikipedia.org\/wiki\/Rekursive_und_iterative_Namensaufl%C3%B6sung\">Rekursive und iterative Namensaufl\u00f6sung<\/a><\/p>\n<p><strong>recursion<\/strong><br \/>\nIf yes, and a DNS query requests recursion, then the server will attempt to do all the work required to answer the query. If recursion is off and the server does not already know the answer, it will return a referral response. The default is yes. Note that setting recursion no does not prevent clients from getting data from the server&#8217;s cache; it only prevents new data from being cached as an effect of client queries. Caching may still occur as an effect the server&#8217;s internal operation, such as NOTIFY address lookups. See also fetch-glue above. <\/p>\n<p><strong>fetch-glue<\/strong><br \/>\nThis option is obsolete. In BIND 8, fetch-glue yes caused the server to attempt to fetch glue resource records it didn&#8217;t have when constructing the additional data section of a response. This is now considered a bad idea and BIND 9 never does it.<\/p>\n<p><a href=\"http:\/\/www.bind9.net\/manual\/bind\/9.3.2\/Bv9ARM.ch06.html\">BIND 9 Configuration Reference<\/a><\/p>\n<h4>Configuring an Authoritative-Only Name Server<\/h4>\n<p><strong>Problem<\/strong><br \/>\nYou want to configure an &#8220;authoritative-only&#8221; or nonrecursive name server.<br \/>\n<a href=\"http:\/\/www.oreillynet.com\/pub\/a\/network\/excerpt\/dnsbindcook_ch07\/\">Cooking with DNS &#038; BIND<\/a><\/p>\n<h3>Wireshark<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n(dns) &amp;&amp; (dns.qry.type == 1)   =&gt; Record type A\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ tcpdump -s 1500 -p 53 -w output.pcap\r\n-s &lt;number&gt;   number in bytes per packet\r\n-w &lt;file&gt;     output file\r\n-p &lt;number&gt;   port number (ex. 53 = DNS)\r\n<\/pre>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/List_of_DNS_record_types\">List of DNS record types<\/a><\/p>\n<h3>Fail2Ban<\/h3>\n<p><a href=\"http:\/\/www.fail2ban.org\/\">Fail2Ban<\/a><br \/>\n<a href=\"http:\/\/blog.nachtarbeiter.net\/2009\/02\/06\/dns-root-query-amplification\/\">DNS Root Query Amplification with Fail2Ban<\/a><br \/>\n<a href=\"http:\/\/www.iredmail.org\/forum\/topic4660-iredmail-support-fail2ban-with-freebsd.html\">Fail2Ban with FreeBSD<\/a><br \/>\n<a href=\"http:\/\/www.effu.se\/2011\/03\/Integrating-PF-with-Fail2ban-0.9\">Integrating PF with Fail2ban 0.9<\/a><\/p>\n<h3>Tutorials<\/h3>\n<p><a href=\"http:\/\/docstore.mik.ua\/orelly\/networking_2ndEd\/dns\/ch10_10.htm\">A Nonrecursive Name Server<\/a>, O&#8217;Reilly DNS and BIND<br \/>\n<a href=\"http:\/\/askubuntu.com\/questions\/170728\/how-to-disable-external-dns-recursion\">How to Disable External DNS recursion?<\/a><br \/>\n<a href=\"http:\/\/susa.wikidot.com\/configuring-bind-non-recursive\">Configuring Bind Non Recursive<\/a><br \/>\n<a href=\"http:\/\/de.wikipedia.org\/wiki\/Rekursive_und_iterative_Namensaufl%C3%B6sung\">Wikipedia: Rekursive und iterative Namensaufl\u00f6sung<\/a><br \/>\n<a href=\"http:\/\/unix.stackexchange.com\/questions\/24383\/what-is-a-recursive-dns-query\">What is a \u201crecursive DNS query\u201d?<\/a><\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# \/usr\/sbin\/named -t \/var\/named -u bind -fg\r\n-t chroot() to directory after processing the command line arguments\r\n-u setuid() to user after completing privileged operations\r\n-f Run the server in the foreground\r\n-g Run the server in the foreground and force all logging to stderr\r\n<\/pre>\n<pre class=\"brush: plain; title: new; notranslate\" title=\"new\">\r\nrecursion  no;\r\n\r\n# \/usr\/sbin\/named -t \/var\/named -u bind -fg\r\n05-Aug-2013 19:58:10.872 starting\r\n05-Aug-2013 19:58:10.876 listening on IPv4 interface em0, 1.2.3.4#53\r\n05-Aug-2013 19:58:10.877 listening on IPv4 interface lo0, 127.0.0.1#53\r\n05-Aug-2013 19:58:10.880 running\r\n05-Aug-2013 19:59:11.360 unexpected RCODE (REFUSED) resolving 'www.XXX.ch\/A\/IN': 1.2.3.4#53\r\n05-Aug-2013 19:59:13.359 lame server resolving 'blog.XXX.net' (in 'XXX.net'?): 1.118.193.3#53\r\n05-Aug-2013 19:59:13.359 lame server resolving 'blog.XXX.net' (in 'XXX.net'?): 2.134.128.59#53\r\n05-Aug-2013 19:59:13.360 lame server resolving 'blog.XXX.net' (in 'XXX.net'?): 2.134.128.59#53\r\n05-Aug-2013 19:59:13.361 lame server resolving 'blog.XXX.net' (in 'XXX.net'?): 1.118.193.3#53\r\n\r\n05-Aug-2013 20:00:22.718 shutting down\r\n05-Aug-2013 20:00:22.719 no longer listening on 1.2.3.4#53\r\n05-Aug-2013 20:00:22.719 no longer listening on 127.0.0.1#53\r\n05-Aug-2013 20:00:22.720 exiting\r\n<\/pre>\n<pre class=\"brush: plain; title: old; notranslate\" title=\"old\">\r\n# \/usr\/local\/sbin\/named -t \/var\/named -u bind -fg -c \/etc\/namedb\/named.conf\r\n29-Sep-2015 20:16:29.117 starting BIND x.x.x. -t \/var\/named -u bind -fg -c \/etc\/namedb\/named.conf\r\n29-Sep-2015 20:16:29.117 found 2 CPUs, using 2 worker threads\r\n29-Sep-2015 20:16:29.117 using 2 UDP listeners per interface\r\n29-Sep-2015 20:16:29.120 using up to 4096 sockets\r\n29-Sep-2015 20:16:29.137 ENGINE_by_id failed (crypto failure)\r\n29-Sep-2015 20:16:29.138 error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:244:\r\n29-Sep-2015 20:16:29.138 error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:450:\r\n29-Sep-2015 20:16:29.138 error:2606A074:engine routines:ENGINE_by_id:no such engine:eng_list.c:417:id=gost\r\n29-Sep-2015 20:16:29.140 initializing DST: crypto failure\r\n29-Sep-2015 20:16:29.140 exiting (due to fatal error)\r\n\r\n# \/usr\/local\/sbin\/named -u bind -fg -c \/etc\/namedb\/named.conf\r\n29-Sep-2015 20:16:51.826 starting BIND x.x.x -u bind -fg -c \/etc\/namedb\/named.conf\r\n29-Sep-2015 20:16:51.826 found 2 CPUs, using 2 worker threads\r\n29-Sep-2015 20:16:51.826 using 2 UDP listeners per interface\r\n29-Sep-2015 20:16:51.829 using up to 4096 sockets\r\n29-Sep-2015 20:16:51.853 loading configuration from '\/etc\/namedb\/named.conf'\r\n29-Sep-2015 20:16:51.855 using default UDP\/IPv4 port range: &#x5B;49152, 65535]\r\n29-Sep-2015 20:16:51.855 using default UDP\/IPv6 port range: &#x5B;49152, 65535]\r\n29-Sep-2015 20:16:51.856 listening on IPv4 interface em0, 195.134.157.20#53\r\n29-Sep-2015 20:16:51.858 listening on IPv4 interface lo0, 127.0.0.1#53\r\n&#x5B;...]\r\n29-Sep-2015 20:16:51.891 command channel listening on 127.0.0.1#953\r\n29-Sep-2015 20:16:51.891 not using config file logging statement for logging due to -g option\r\n29-Sep-2015 20:16:51.892 managed-keys-zone: loaded serial 0\r\n29-Sep-2015 20:16:51.893 redirect-zone: loaded serial 2014060401\r\n29-Sep-2015 20:16:51.907 zone 157.x.x.in-addr.arpa\/IN: loaded serial 2007020101\r\n29-Sep-2015 20:16:51.912 zone xxx.ch\/IN: loaded serial 2007020101\r\n29-Sep-2015 20:16:51.929 zone yyy.ch\/IN: loaded serial 2007020101\r\n29-Sep-2015 20:16:51.930 all zones loaded\r\n29-Sep-2015 20:16:51.933 running\r\n<\/pre>\n<p><a href=\"http:\/\/serverfault.com\/questions\/438235\/what-is-the-meaning-of-these-bind-log-messages\">What is the meaning of these BIND log messages?<\/a><\/p>\n<ul>\n<li>&#8220;unexpected RCODE (SERVFAIL)&#8230;&#8221;<\/li>\n<li>&#8220;lame server resolving&#8230;&#8221;<\/li>\n<\/ul>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nallow-recursion { 127.0.0.1; };\r\n\r\n05-Aug-2013 20:05:39.820 starting\r\n05-Aug-2013 20:05:39.824 loading configuration from '\/etc\/namedb\/named.conf'\r\n05-Aug-2013 20:05:39.825 listening on IPv4 interface em0, 1.2.3.4#53\r\n05-Aug-2013 20:05:39.825 listening on IPv4 interface lo0, 127.0.0.1#53\r\n05-Aug-2013 20:05:39.830 zone 0.0.127.in-addr.arpa\/IN: loaded serial 2007020101\r\n05-Aug-2013 20:05:39.832 zone AAA.ch\/IN: loaded serial 2007020101\r\n05-Aug-2013 20:05:39.833 zone BBB.ch\/IN: loaded serial 2007020101\r\n05-Aug-2013 20:05:39.833 zone CCC.ch\/IN: loaded serial 2007020101\r\n05-Aug-2013 20:05:39.834 zone DDD.ch\/IN: loaded serial 2007020101\r\n05-Aug-2013 20:05:39.835 zone localhost\/IN: loaded serial 2007020101\r\n05-Aug-2013 20:05:39.837 running\r\n05-Aug-2013 20:05:39.837 zone localhost\/IN: sending notifies (serial 2007020101)\r\n05-Aug-2013 20:05:39.838 zone AAA.ch\/IN: sending notifies (serial 2007020101)\r\n05-Aug-2013 20:05:39.838 zone BBB.net\/IN: sending notifies (serial 2007020101)\r\n05-Aug-2013 20:05:39.838 zone CCC.net\/IN: sending notifies (serial 2007020101)\r\n05-Aug-2013 20:05:39.838 zone DDD.net\/IN: sending notifies (serial 2007020101)\r\n05-Aug-2013 20:05:39.838 zone 0.0.127.in-addr.arpa\/IN: sending notifies (serial 2007020101)\r\n05-Aug-2013 20:05:39.838 client 1.2.3.4#56328: received notify for zone 'localhost'\r\n05-Aug-2013 20:05:40.339 client 1.2.3.4#56328: received notify for zone 'AAA.ch'\r\n05-Aug-2013 20:05:40.339 client 1.2.3.4#56328: received notify for zone 'BBB.net'\r\n05-Aug-2013 20:05:40.340 client 1.2.3.4#56328: received notify for zone 'CCC.net'\r\n05-Aug-2013 20:05:40.340 client 1.2.3.4#56328: received notify for zone 'DDD.net'\r\n05-Aug-2013 20:05:40.840 client 1.2.3.4#56328: received notify for zone '0.0.127.in-addr.arpa'\r\n\r\n05-Aug-2013 20:09:10.348 shutting down\r\n05-Aug-2013 20:09:10.348 no longer listening on 1.2.3.4#53\r\n05-Aug-2013 20:09:10.348 no longer listening on 127.0.0.1#53\r\n05-Aug-2013 20:09:10.350 exiting\r\n<\/pre>\n<p><a href=\"http:\/\/wiki.linuxmce.org\/index.php\/How_to_setup_Local_Authoritative_DNS\">How to setup Local Authoritative DNS<\/a><br \/>\n<a href=\"http:\/\/www.tokiwinter.com\/bind-10-authoritative-dns-server\/\">BIND 10: Authoritative DNS Server<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>BIND 9.9.7 BIND 9.9.5 Book: ZyTrax Pro DNS and BIND Time-to-Live (TTL) Values Start of Authority Resource Record (SOA) BIND Time formats IPv6 Address Record (AAAA) HOWTO Close an Open DNS DNS BIND Query Statements DNS Configuration Types DNS Sample BIND Configurations $ORIGIN, @ and blank Substitution DNS BIND9 logging Clause #s = seconds = [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-679","post","type-post","status-publish","format-standard","hentry","category-freebsd"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=679"}],"version-history":[{"count":31,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/679\/revisions"}],"predecessor-version":[{"id":4078,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/679\/revisions\/4078"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}