| 5848 | | As of 2.9.4, a small recursor comes with PowerDNS. The algorithm is influenced by the works of Dan J. Bernstein although |
| 5849 | | all mistakes are ours. Here are the current faults, so nobody can accuse us of false advertising: |
| 5850 | | <itemizedlist> |
| 5851 | | <listitem><para> |
| 5852 | | Only compiles on Linux, FreeBSD 5.x, Windows and possibly Solaris. FreeBSD 4.x decided not to support the |
| 5853 | | POSIX get/set/swapcontext functions. Bug your favorite FreeBSD kernel or libc maintainer for a fix, |
| 5854 | | or ask him to port MTasker (see below) to your operating system. It may work on recent 4.x systems, |
| 5855 | | let us know! |
| 5856 | | </para></listitem> |
| 5857 | | <listitem><para> |
| 5858 | | May have big problems with truncated packets (solved in 2.9.18) |
| 5859 | | </para></listitem> |
| 5860 | | </itemizedlist> |
| | 5848 | The PowerDNS recursor is part of the source tarball of the main PowerDNS distribution, but it is released separately. Starting from |
| | 5849 | the version 3.0 pre-releases, there are zero known bugs or issues with the recursor. It is known to power the resolving needs of over 2 million |
| | 5850 | internet connections. |
| 5877 | | <listitem><para> |
| 5878 | | Appears to be very fast, and contains innovative query-throttling code to save time talking to obsolete or broken nameservers. |
| | 5865 | <listitem><para> |
| | 5866 | Powered by a highly modern DNS packet parser that should be resistant against many forms of buffer overflows. |
| | 5867 | </para></listitem> |
| | 5868 | <listitem><para> |
| | 5869 | Best spoofing protection that we know about, involving both source port randomisation and spoofing detection. |
| | 5870 | </para></listitem> |
| | 5871 | <listitem><para> |
| | 5872 | Uses 'connected' UDP sockets which allow the recursor to react quickly to unreachable hosts or hosts for which |
| | 5873 | the server is running, but the nameserver is down. This makes the recursor faster to respond in case of misconfigured domains, |
| | 5874 | which are sadly very frequent. |
| | 5875 | </para></listitem> |
| | 5876 | <listitem><para> |
| | 5877 | Special support for FreeBSD, Linux and Solaris stateful multiplexing (kqueue, epoll, completion ports). |
| | 5878 | </para></listitem> |
| | 5879 | <listitem><para> |
| | 5880 | Very fast, and contains innovative query-throttling code to save time talking to obsolete or broken nameservers. |
| 5916 | | Comma separated netmasks that are allowed to use the server. The default allows complete access! |
| 5917 | | </para> |
| 5918 | | </listitem> |
| 5919 | | </varlistentry> |
| | 5924 | Comma separated netmasks (both IPv4 and IPv6) that are allowed to use the server. The default allows access only from RFC 1918 |
| | 5925 | private IP addresses, like 10.0.0.0/8. Due to the agressive nature of the internet these days, it is highly recommended |
| | 5926 | to not open up the recursor for the entire internet. Questions from IP addresses not listed here are ignored and do |
| | 5927 | not get an answer. |
| | 5928 | </para> |
| | 5929 | </listitem> |
| | 5930 | </varlistentry> |
| | 5931 | <varlistentry><term>chroot</term> |
| | 5932 | <listitem><para> |
| | 5933 | If set, chroot to this directory for more security. See <xref linkend="security">. |
| | 5934 | </para></listitem></varlistentry> |
| | 6127 | <sect2 id="rec-control"><title>Controlling and querying the recursor</title> |
| | 6128 | <para> |
| | 6129 | To control and query the PowerDNS recursor, the tool <filename>rec_control</filename> is provided. This program |
| | 6130 | talks to the recursor over the 'controlsocket', often stored in <filename>/var/run</filename>. |
| | 6131 | </para> |
| | 6132 | <para> |
| | 6133 | As a sample command, try: |
| | 6134 | <screen> |
| | 6135 | # rec_control ping |
| | 6136 | pong |
| | 6137 | </screen> |
| | 6138 | </para> |
| | 6139 | <para> |
| | 6140 | When not running as root, <command>--socket-dir=/tmp</command> might be appropriate. |
| | 6141 | </para> |
| | 6142 | <para> |
| | 6143 | All rec_control commands are documented below: |
| | 6144 | <variablelist> |
| | 6145 | <varlistentry> |
| | 6146 | <term>dump-cache filename</term> |
| | 6147 | <listitem> |
| | 6148 | <para> |
| | 6149 | Dumps the entire cache to the filename mentioned. This file should not exist already, PowerDNS |
| | 6150 | will refuse to overwrite it. While dumping, the recursor will not answer questions. |
| | 6151 | </para> |
| | 6152 | </listitem> |
| | 6153 | </varlistentry> |
| | 6154 | <varlistentry> |
| | 6155 | <term>get statistic</term> |
| | 6156 | <listitem> |
| | 6157 | <para> |
| | 6158 | Retrieve a statistic. For items that can be queried, see below. |
| | 6159 | </para> |
| | 6160 | </listitem> |
| | 6161 | </varlistentry> |
| | 6162 | <varlistentry> |
| | 6163 | <term>ping</term> |
| | 6164 | <listitem> |
| | 6165 | <para> |
| | 6166 | Check if server is alive. |
| | 6167 | </para> |
| | 6168 | </listitem> |
| | 6169 | </varlistentry> |
| | 6170 | <varlistentry> |
| | 6171 | <term>quit</term> |
| | 6172 | <listitem> |
| | 6173 | <para> |
| | 6174 | Request shutdown of the recursor. |
| | 6175 | </para> |
| | 6176 | </listitem> |
| | 6177 | </varlistentry> |
| | 6178 | <varlistentry> |
| | 6179 | <term>top-remotes</term> |
| | 6180 | <listitem> |
| | 6181 | <para> |
| | 6182 | Shows the top-20 most active remote hosts. Statistics are over the last 'remotes-ringbuffer-entries' queries, which |
| | 6183 | defaults to 0. |
| | 6184 | </para> |
| | 6185 | </listitem> |
| | 6186 | </varlistentry> |
| | 6187 | <varlistentry> |
| | 6188 | <term>wipe-cache domain0. [domain1. domain2.]</term> |
| | 6189 | <listitem> |
| | 6190 | <para> |
| | 6191 | Wipe entries from the cache. This is useful if, for example, an important server has a new IP address, but the TTL has not |
| | 6192 | yet expired. Multiple domain names can be passed. Note that you must terminate a domain with a .! So to wipe powerdns.org, |
| | 6193 | issue 'rec_control wipe-cache powerdns.org.'. |
| | 6194 | </para> |
| | 6195 | <para> |
| | 6196 | <warning> |
| | 6197 | <para> |
| | 6198 | Ubunty Breezy ships a version of Boost that has problems with this command! Either refrain from |
| | 6199 | using wipe-cache or download a more recent Boost into the PowerDNS source directory, as explained in the |
| | 6200 | <filename>README</filename> |
| | 6201 | </para> |
| | 6202 | </warning> |
| | 6203 | </para> |
| | 6204 | </listitem> |
| | 6205 | </varlistentry> |
| | 6206 | </variablelist> |
| | 6207 | </para> |
| | 6208 | <para> |
| | 6209 | The command 'get' can query a large number of statistics, which are detailed in <xref linkend="recursor-stats">. |
| | 6210 | |
| | 6211 | </para> |
| | 6212 | <para> |
| | 6213 | More details on what 'throttled' queries and the like are can be found below in <xref linkend="recursor-details">. |
| | 6214 | </para> |
| | 6215 | </sect2> |
| | 6216 | |
| 6095 | | <sect1><title>Statistics</title> |
| | 6275 | <sect1 id="recursor-stats"><title>Statistics</title> |
| | 6276 | <para> |
| | 6277 | The <command>rec_control get</command> command can be used to query the following keys, either single keys or multiple keys |
| | 6278 | at once: |
| | 6279 | <screen> |
| | 6280 | all-outqueries counts the number of outgoing UDP queries since starting |
| | 6281 | answers0-1 counts the number of queries answered within 1 milisecond |
| | 6282 | answers100-1000 counts the number of queries answered within 1 second |
| | 6283 | answers10-100 counts the number of queries answered within 100 miliseconds |
| | 6284 | answers1-10 counts the number of queries answered within 10 miliseconds |
| | 6285 | answers-slow counts the number of queries answered after 1 second |
| | 6286 | cache-entries shows the number of entries in the cache |
| | 6287 | cache-hits counts the number of cache hits since starting |
| | 6288 | cache-misses counts the number of cache misses since starting |
| | 6289 | client-parse-errors counts number of client packets that could not be parsed |
| | 6290 | concurrent-queries shows the number of MThreads currently running |
| | 6291 | negcache-entries shows the number of entries in the Negative answer cache |
| | 6292 | noerror-answers counts the number of times it answered NOERROR since starting |
| | 6293 | nsspeeds-entries shows the number of entries in the NS speeds map |
| | 6294 | nxdomain-answers counts the number of times it answered NXDOMAIN since starting |
| | 6295 | outgoing-timeouts counts the number of timeouts on outgoing UDP queries since starting |
| | 6296 | qa-latency shows the current latency average |
| | 6297 | questions counts all End-user initiated queries with the RD bit set |
| | 6298 | resource-limits counts number of queries that could not be performed because of resource limits |
| | 6299 | server-parse-errors counts number of server replied packets that could not be parsed |
| | 6300 | servfail-answers counts the number of times it answered SERVFAIL since starting |
| | 6301 | spoof-prevents number of times PowerDNS considered itself spoofed, and dropped the data |
| | 6302 | sys-msec number of CPU milliseconds spent in 'system' mode |
| | 6303 | tcp-client-overflow number of times an IP address was denied TCP access because it already had too many connections |
| | 6304 | tcp-outqueries counts the number of outgoing TCP queries since starting |
| | 6305 | tcp-questions counts all incoming TCP queries (since starting) |
| | 6306 | throttled-out counts the number of throttled outgoing UDP queries since starting |
| | 6307 | throttle-entries shows the number of entries in the throttle map |
| | 6308 | unauthorized-tcp number of TCP questions denied because of allow-from restrictions |
| | 6309 | unauthorized-udp number of UDP questions denied because of allow-from restrictions |
| | 6310 | unexpected-packets number of answers from remote servers that were unexpected (might point to spoofing) |
| | 6311 | user-msec number of CPU milliseconds spent in 'user' mode |
| | 6312 | </screen> |
| | 6313 | In the <filename>rrd/</filename> subdirectory a number of rrdtool scripts is provided to make nice |
| | 6314 | graphs of all these numbers. |
| | 6315 | </para> |