How do I disable the DNS service in Core 18?


#1

I am building a pihole appliance for a friend, the service runs on port 53.

Ubuntu Core 18 comes with systemd-resolved running, and I’m looking for a way to turn it off so that pihole’s dnsmasq can run on that port.

Things I’ve tried:

  • Setting DNSStubListener=no in /dev/systemd/resolved.conf results in the host unable to resolve DNS for itself.
    • Also tried setting a DNS= and FallbackDNS= entry here with no success
  • Can’t mess with the /etc/resolv.conf symlink because the fs is read only.
  • /run/systemd/resolve/stub-resolv.conf is where the resolv.conf symlink ends up. Chaning it here works but I am unsure how I can make this setting stick through a reboot.
  • Adding an entry in /etc/netplan/00-snapd-config.yaml and then generating/applying also doesn’t seem to work and survive reboots. Running console-conf manually doesn’t even ask me to set a DNS server.

Any tips/ideas? Thanks in advance!


#2

looking at

it seems like the network-control interface offers you access to the dbus interface of systemd-resolved, perhaps you can create some wrapper service that utilizes it to set the right DNS entries on boot ?


#3

It seems you should be able to use busctl to access the DBus interface of systemd-resolved.