@echo PLEASE READ: for an easy fix!
@echo
+basic_checks:
+ @-rm -f pdns_hw
+ -$(CXX) $(CXXFLAGS) pdns_hw.cc -o pdns_hw
+ @echo
+ @if test -x ./pdns_hw ; \
+ then if ./pdns_hw; then echo Everything ok, now run $(MAKE) using same settings \(if any\) you passed ./configure; else echo Could compile binary, but not run it, read README please ; fi; \
+ else \
+ echo; echo Could not compile simple binary, read README please; \
+ rm -f dep ; \
+ fi
+
install: all
- -mkdirhier $(DESTDIR)/$(SBINDIR)
- install -s pdns_recursor $(DESTDIR)/$(SBINDIR)
- mkdirhier $(DESTDIR)/$(BINDIR)
- install -s rec_control $(DESTDIR)/$(BINDIR)
- -mkdirhier $(DESTDIR)/$(CONFIGDIR)
- ./pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf
- -mkdirhier $(DESTDIR)/usr/share/man/man1
+ -mkdir -p $(DESTDIR)/$(SBINDIR)
+ mv pdns_recursor $(DESTDIR)/$(SBINDIR)
+ strip $(DESTDIR)/$(SBINDIR)/pdns_recursor
+ mkdir -p $(DESTDIR)/$(BINDIR)
+ mv rec_control $(DESTDIR)/$(BINDIR)
+ strip $(DESTDIR)/$(BINDIR)/rec_control
+ -mkdir -p $(DESTDIR)/$(CONFIGDIR)
+ $(DESTDIR)/$(SBINDIR)/pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf
+ -mkdir -p $(DESTDIR)/usr/share/man/man1
cp pdns_recursor.1 rec_control.1 $(DESTDIR)/usr/share/man/man1
$(OS_SPECIFIC_INSTALL)
clean:
- -rm -f *.o *~ pdns_recursor rec_control optional/*.o
+ -rm -f dep *.o *~ pdns_recursor rec_control optional/*.o
dep:
- $(CXX) $(CXXFLAGS) -MM *.cc *.hh > $@
+ $(CXX) $(CXXFLAGS) -MM -MG *.cc *.hh > $@
-include dep
COMPILING
---------
+$ ./configure
+$ make or gmake
+
The only dependency is Boost, http://boost.org/
You only need to download it, there is no need to compile.
3) Compile the PowerDNS recursor using:
-$ CXXFLAGS=-I./boost_1_33_1/ make
+$ CXXFLAGS=-I./boost_1_33_1/ ./configure
+$ CXXFLAGS=-I./boost_1_33_1/ make clean
+$ CXXFLAGS=-I./boost_1_33_1/ make all
+(the 'clean' is needed to have make pick up the new boost)
4) Run ./pdns_recursor and you should be set!
+5) (g)make install
+
PERFORMANCE
-----------
------------------------------
To prevent hassles with g++ 4.1 dependencies, you can build like this:
$ STATIC=semi make all
-or even
- $ STATIC=full make all
PROBLEMS
--------
--- /dev/null
+#!/bin/sh
+echo Testing dependencies and compiler.
+
+GMAKE=`which gmake`
+if test -z "$GMAKE"
+then
+ make basic_checks
+else
+ echo Using gmake to build
+ gmake basic_checks
+fi
+
logger.cc arguments.cc lwres.cc pdns_recursor.cc \
recursor_cache.cc dnsparser.cc dnswriter.cc dnsrecords.cc rcpgenerator.cc \
base64.cc zoneparser-tng.cc rec_channel.cc rec_channel_rec.cc rec_control.cc \
-selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc"
+selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc pdns_hw.cc"
cd docs
make pdns_recursor.1 rec_control.1
cp ext/nedmalloc/malloc.c $DIRNAME
cp pdns-recursor.init.d $DIRNAME
cp docs/pdns_recursor.1 docs/rec_control.1 $DIRNAME
+cp configure-recursor $DIRNAME/configure
mkdir -p $DIRNAME/sysdeps
cp sysdeps-recursor/* $DIRNAME/sysdeps
</listitem>
<listitem>
<para>
- delegation-only, a Verisign special. See <xref linkend="verisign">.
+ delegation-only, a Verisign special.
</para>
</listitem>
<listitem>
<term>delegation-only</term>
<listitem>
<para>
- A Verisign special, see <xref linkend="verisign">.
+ A Verisign special.
</para>
</listitem>
</varlistentry>
</varlistentry>
</variablelist>
<para>
- <sect2 id="rec-control"><title>Controlling and querying the recursor</title>
- <para>
- To control and query the PowerDNS recursor, the tool <filename>rec_control</filename> is provided. This program
- talks to the recursor over the 'controlsocket', often stored in <filename>/var/run</filename>.
- </para>
- <para>
- As a sample command, try:
- <screen>
- # rec_control ping
- pong
- </screen>
- </para>
- <para>
- When not running as root, <command>--socket-dir=/tmp</command> might be appropriate.
- </para>
+ </sect1>
+ <sect1 id="rec-control"><title>Controlling and querying the recursor</title>
+ <para>
+ To control and query the PowerDNS recursor, the tool <filename>rec_control</filename> is provided. This program
+ talks to the recursor over the 'controlsocket', often stored in <filename>/var/run</filename>.
+ </para>
+ <para>
+ As a sample command, try:
+ <screen>
+ # rec_control ping
+ pong
+ </screen>
+ </para>
+ <para>
+ When not running as root, <command>--socket-dir=/tmp</command> might be appropriate.
+ </para>
<para>
All rec_control commands are documented below:
<variablelist>
<para>
More details on what 'throttled' queries and the like are can be found below in <xref linkend="recursor-details">.
</para>
- </sect2>
-
- <sect2 id="verisign"><title>Verisign weirdness</title>
- <para>
- <note>
+ </sect1>
+ <sect1 id="recursor-performance"><title>PowerDNS Recursor performance</title>
+ <para>
+ To get the best out of the PowerDNS recursor, which is important if you are doing thousands of queries per second, please
+ consider the following.
+ <itemizedlist>
+ <listitem>
<para>
- Verisign backed off, this feature is no longer needed (for now).
+ Limit the size of the cache to a sensible value. Cache hit rate does not improve meaningfully beyond 4 million <command>max-cache-entries</command>,
+ reducing the memory footprint reduces CPU cache misses.
</para>
- </note>
- </para>
- <para>
- Verisign, the current operator of the COM and NET zones, decided to add a wildcard record so as to draw all queries for non-existing
- domains to their own page, which lists domains you might want to visist instead.
- </para>
- <para>
- To reinstate old behaviour, add <command>delegation-only=com,net</command> to your recursor configuration.
- </para>
- <para>
- What this does is reject all authoritative answers from the COM and NET servers. ISC, the current maintainers of BIND, have
- implemented this feature first, PowerDNS has mostly copied their algorithm. Thanks!
- </para>
- <para>
- Verisign might decide to evade our tactic with wildcard NS records, by which time other measures will be needed to restore the
- old behaviour.
- </para>
- </sect2>
-
-
+ </listitem>
+ <listitem>
+ <para>
+ Compile using g++ 4.1 or later. This compiler really does a good job on PowerDNS, much better than 3.4 or 4.0.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Consider performing a 'profiled build' as described in the README. This is good for a 20% performance boost in some cases.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ When running with >3000 queries per second, and running Linux versions prior to 2.6.17 on some motherboards, your computer may
+ spend an inordinate amount of time working around an ACPI bug for each call to gettimeofday. This is solved by rebooting with 'clock=tsc'
+ or upgrading to a 2.6.17 kernel.
+ </para>
+ <para>
+ The above is relevant if dmesg shows <command>Using pmtmr for high-res timesource</command>
+ </para>
+ </listitem>
+ </itemizedlist>
+ Following the instructions above, you should be able to attain very high query rates.
+ </para>
</sect1>
<sect1 id="recursor-details"><title>Details</title>
<para>
d_inaxfr=false;
d_rcode=0;
-
struct sockaddr_in toaddr;
Utility::socklen_t addrlen=sizeof(toaddr);
toaddr.sin_addr.s_addr=htonl(ip);
doPC()
{
- ret=$($BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null)
+ ret=`$BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null`
}
--- /dev/null
+#include <boost/lexical_cast.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+#include <boost/tuple/tuple_comparison.hpp>
+#include <boost/multi_index/key_extractors.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
+#include <sstream>
+
+using namespace std;
+int main()
+{
+ ostringstream str;
+ str << "Everything is ok!"<< boost::lexical_cast<string>("") <<"\n";
+ exit(0);
+}
if(d_cacheonly)
return 0;
+ // place for lookaside cache
+
LOG<<prefix<<qname<<": No cache hit for '"<<qname<<"|"<<qtype.getName()<<"', trying to find an appropriate NS record"<<endl;
string subdomain(qname);
+CC=gcc
LDFLAGS+=-lresolv -lsocket -lnsl
+OS_SPECIFIC_INSTALL=mkdir -p $(DESTDIR)/etc/init.d ; cp pdns-recursor.init.d $(DESTDIR)/etc/init.d/pdns-recursor
OPTIONALS:=optional/portsmplexer.o