randy/unbound-despite-systemd.md
2020-04-29 12:43:23 -07:00

1.1 KiB

In the world of systemd, it wants to control everything. This usually turns out badly for everyone. This is especially true for unbound.

Edit /etc/hosts to know the short and long form of the host's name

If this is Ubuntu 18.04, set the hostnme in a very broque manner

sudo hostnamectl set-hostname build1.sjc.arrcus.com

Then one has to edit /etc/cloud/cloud.cfg and change

preserve_hostname: false

to

preserve_hostname: true

To tell systemd to keep its claws off the DNS, the following hacks seem to work as of Ubuntu 18.04 after apt-get install unbound:

sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop

Then tell unbound to regenerate its remote control junk.

sudo rm /etc/unbound/unbound_control.* /etc/unbound/unbound_server.*
sudo unbound-control-setup

Then make sure that /etc/resolv.conf points to localhost.

nameserver 127.0.0.1
nameserver ::1

The better way to do this is at boot time with /etc/network/interfaces

auto eth0
iface eth0 inet static
    address ...
    gateway ...
    dns-nameserver 127.0.0.1
    dns-nameserver ...

2020.04.29