Intranet: [ArchLinux] Setup a DNSCACHE for your network using DJBDNS

This is a version of this post http://blog.portnumber53.com/2012/01/15/intranet-setup-a-dnscache-for-your-network-using-djbdns/ for the ArchLinuxARM:

 

Essentials:

# pacman -Syu fakeroot patch make gcc dnsutils

 

Daemontools installation

$ wget https://aur.archlinux.org/packages/da/daemontools/daemontools.tar.gz

$ tar -xvzf daemontools.tar.gz

$ cd daemontools

$ nano PKGBUILD

——————–

arch=('arm')

——————–

$ makepkg

$ sudo pacman -U daemontools-0.76-5-arm.pkg.tar.xz

 

You shoould see this:

loading packages…
resolving dependencies…
looking for inter-conflicts…

Targets (1): daemontools-0.76-5

Total Installed Size:   0.30 MiB

Proceed with installation? [Y/n] y
(1/1) checking package integrity                                      [######################################] 100%
(1/1) loading package files                                           [######################################] 100%
(1/1) checking for file conflicts                                     [######################################] 100%
(1/1) installing daemontools                                          [######################################] 100%
Adding svscanboot to inittab…
init should start svscan now.
[root@heart daemontools]#

 

ucspi-tcp 0.88-3

 

 

 

 

 

 

 

 

UCSPI-TCP

$ wget https://aur.archlinux.org/packages/uc/ucspi-tcp/ucspi-tcp.tar.gz

$ tar -xvzf ucspi-tcp.tar.gz

$ cd ucspi-tcp

$ nano PKGBUILD

——————–

arch=('arm')

——————–

change line 36 to:

install -m 755 -D $bin $pkgdir/usr/bin/$bin

(refer to the comments at https://aur.archlinux.org/packages.php?ID=8330 )

 

$ sudo pacman -U ucspi-tcp-0.88-3-arm.pkg.tar.xz

 

 

Now for the real thing:

 

$ wget https://aur.archlinux.org/packages/dj/djbdns-ipv4/djbdns-ipv4.tar.gz

$ tar -xvzf djbdns-ipv4.tar.gz

$ cd djbdns-ipv4/

I built mine on my PogoPlug, so I needed to edit  PKGBUILD and edited: arch=('arm')

$ makepkg

$ sudo pacman -U djbdns-ipv4-1.05-2-arm.pkg.tar.xz

 

============

>>> Configure and run tinydns:
    tinydns-conf _tinydns _dnslog /service/tinydns [IP]
    ln -s /service/tinydns /etc/

>>> Configure and run dnscache as a recursive cache:
    dnscache-conf _dnscache _dnslog /service/dnscache [IP]
    ln -s /service/dnscache /etc/

>>> To change from recursive to forward-only:
    echo 1 > /service/dnscache/env/FORWARDONLY
    echo IP_address_of_a_recursive_DNS server > /service/dnscache/root/servers/@
    echo IP_address_of_another_recursive_DNS server >> /service/dnscache/root/servers/@

>>> To add a local authoritative server to a recursive or forward-only setup:
    echo IP_address_of_a_local_authoritative_server > /service/dnscache/root/servers/name.of.toplevel.domain

If [IP] is omitted dnscache will run on localhost.
More help can be found at http://cr.yp.to/djbdns.html

Read /usr/share/djbdns/README for more information about this package.

=================

 

Let's set up the dns cache on the box's IP (10.0.0.240 in the example)

 

 

# dnscache-conf _dnscache _dnslog /etc/dnscache 10.0.0.240

Start it

# ln -s /etc/dnscache /service/

ps ax should show something like:

9438 ?        S      0:00 supervise dnscache
 9439 ?        S      0:00 supervise log
 9440 ?        S      0:00 multilog t ./main
 9441 ?        S      0:00 /usr/bin/dnscache
 

Tell DNSCACHE to accept queries from your intranet:

touch /etc/dnscache/root/ip/10

 

Let's tail its log:

# tail -f /service/dnscache/log/main/current

And test it, opening another terminal

# dnsip www.cnn.com

As of this writing you should see:

157.166.255.18 157.166.255.19 157.166.226.26 157.166.226.25

and a bunch of log output

 

 

  • IGlr