if you divert all dns requests to an unbound server, this sets
things up so replies to diverted udp requests come from what looks
like the right IP.
set_recvpktinfo() needs to be called on listening sockets so the
kernel will wire up the control messages that include the original
destination ip address of the packet.
comm_point_create_udp_ancil() needs to be used instead of
comm_point_create_udp() so it will use recvmsg with a control message
buffer and process the CMSGs inside it.
for IP_SENDSRCMSG to work when sending the replies to the diverted
client, the listening socket also has to be set up with the SO_BINDANY
sockopt.
Unbound is a validating, recursive, caching DNS resolver. It is designed to be
fast and lean and incorporates modern features based on open standards. If you
have any feedback, we would love to hear from you. Don’t hesitate to
create an issue on Github
or post a message on the Unbound mailing list.
You can learn more about Unbound by reading our
documentation.
Compiling
Make sure you have the C toolchain, OpenSSL and its include files, and libexpat
installed. Unbound can be compiled and installed using:
./configure && make && make install
You can use libevent if you want. libevent is useful when using many (10000)
outgoing ports. By default max 256 ports are opened at the same time and the
builtin alternative is equally capable and a little faster.
Use the --with-libevent=dir configure option to compile Unbound with libevent
support.
Unbound configuration
All of Unbound's configuration options are described in the man pages, which
will be installed and are available on the Unbound
documentation page.