User Tools

Site Tools


Installation and configuration reminder for my RaspBerry Pi Model B as DNS :!: Doesn't work, thanks to systemd that doesn't really like static IPs → DELETEME It is now fully working under Debian!


To strengthen and add some fun at home I build a DNS out of the RaspBerry Pi.
:!: This is for home use only, this dns is not resolved from outside :!:

Here's the output of lsusb

Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. LAN9500 Ethernet 10/100 Adapter / SMSC9512/9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Here's the output of cpuinfo

Processor       : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : swp half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7
Hardware        : BCM2708
Revision        : 000e

Partition table

MMC1mmcblk0p1/boot95MBVFATBoot partition

Base install


First install

Check the page for latest img

dd if=archlinux-hf-2013-07-22.img of=/dev/mmcblk0 bs=1M

Extend the root partition with the free space: gparted :-)

Move the MMC card to the Raspberry Pi

Remote access

Headless (for my case) so I check on the DHCP for a newcomer.
SSH to it

ssh root@

Default password is root

Basic configuration

First change this root password


System Upgrade

Simple as

pacman -Syu

Change Vi to Vim

pacman -S vim
rm /usr/bin/vi &&  ln -s /usr/bin/vim /usr/bin/vi


vi /etc/locale.gen

I'll use en_US.utf-8/iso8859 so uncomment:

en_US.UTF-8 UTF-8
en_US ISO-8859-1

Then generate locales


Configure them Locale:

vi /etc/locale.conf 
# Keep the default sort order (e.g. files starting with a '.'
# should appear at the start of a directory listing.)

Configure the console (in case of direct connection): Default keyboard in console (US variant international … with a different mapping than on X11! Well done)

echo "KEYMAP=us-acentos" > /etc/vconsole.conf


ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime

Network configuration

Let's change the hostname

 echo dns1.home > /etc/hostname

I will use a static netctl config

cp /etc/netctl/examples/ethernet-static /etc/netctl/.
vi /etc/netctl/ethernet-static
Description='A basic static ethernet connection'
#Routes=(' via')
ExecUpPost='/usr/bin/ntpd -q || true'
## For IPv6 autoconfiguration
## For IPv6 static address configuration
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')

Disable dhcpcd on eth0

systemctl disable dhcpcd@eth0

Make it default

netctl enable ethernet-static
netctl start ethernet-static

:!:A nice reboot is mandatory … didn't find a way to reload network configuration

Some tools

pacman -S screen bash-completion glances htop lftp rsync wget curl bc lsof strace base-devel

Select all base-devel tools even if some are already in place



pacman -S ntp

Normally already installed and started

vi /etc/ntp.conf
server iburst
server iburst
server iburst
server iburst
systemctl enable ntpd
systemctl start ntpd


Would have been nice with a chroot but thanks to systemd no scripts are available for arch yet (and no I won't even try to make some)


Installation is pretty straight forward:

pacman -S bind dnsutils


vi /etc/named.conf

Add your local zone and the reverse

zone "home" IN {
        type master;
        file "";
zone "" IN {
        type master;
        file "home.rev";


Then configure files for the zones:

  • /var/named/
$TTL   3h
@ IN SOA dns1.home. root.home. (
    2013083101 ; serial
    3h         ; refresh after 3 hours
    1h         ; retry after 1 hour
    1w         ; expire after 1 week
    1h )       ; negative caching TTL of 1 hour
        IN NS dns1.home.
;network devices and Services [1-30]
router  IN A
dns     IN A
wifi    IN A
  • /var/named/home.rev
$TTL   3h
@ IN SOA dns1.home. root.home. (
    2013083101 ; serial
    3h         ; refresh after 3 hours
    1h         ; retry after 1 hour
    1w         ; expire after 1 week
    1h )       ; negative caching TTL of 1 hour
        IN NS dns1.home.
;network devices and Services [1-30]
1       IN PTR  router.home.
2       IN PTR  dns.home.
3       IN PTR  wifi.home.


Change it to simply:

search home

Search <domain> will help using network tools without the domain after
:!: Important, since a lot of stupid services try to rewrite resolv.conf BLOCK it :!:

chattr +i /etc/resolv.conf

No comments on standards - I deeply regret not having openBSD here …

Final step

Enable it

systemctl enable named

Start it

systemctl start named


Weel first try to dig/nslookup:

Address:        name = router.home.
#nslookup router.home
Name:   router.home

See the performances:

for i in {1..30}; do echo; done | xargs -I^ -P10 dig ^ | grep time | awk /time/'{sum+=$4} END { print "Average query = ",sum/NR,"ms"}'
Average query =  33.6667 ms



You can check this wiki DNS
You need

pacman -S dos2unix

Add in /etc/named.conf

include "blockeddomains.zones";

In /var/named create a file called blockeddomain.hosts with:

$TTL   3h
@ IN SOA dns.home. root.home. (
    2013071502 ; serial
    3h         ; refresh after 3 hours
    1h         ; retry after 1 hour
    1w         ; expire after 1 week
    1h )       ; negative caching TTL of 1 hour
              IN      NS      dns.home.
*             IN      A
*             IN      AAAA    ::1

then use this script to generate the blockeddomains.zones file:

#! /bin/sh
# Script that generate a blockeddomains.zones according to a nice hosts file on the internet
# First rm previous version of downloaded and generated files
rm blockeddomains.zones hosts.txt
# Get the hosts file
# Convert to Unix
dos2unix hosts.txt
# For each line in the file that starts with 127, doesn't contain localhost we take the 3rd field (domain)
for line in `cat hosts.txt | grep ^127 | grep -v localhost | cut -d " " -f 3`
     # Create an entry in  blockeddomain.zones with the correct syntax pretending we own this domain :P
     printf "zone \"$line\"  {type master; file \"blockeddomain.hosts\";};\n" >> blockeddomains.zones

Then copy it to /var/named and relaunch named

copy blockeddomains.zones /var/named/.
systemctl reload named

try a nslookup/dig on one of the domain and … it will redirect on :D

os/archlinux/pidns.txt · Last modified: 2021/12/29 20:03 by warnaud