0

I like working with Ubuntu but today I have a problem. With 18.04 LTS arrived Netplan and systemd-resolve. I want to deploy CoreDNS on a 18.04 server. If Netplan is the future then I would like to have a method for deploying CoreDNS, have usage of 53/tcp and 53/udp without having to "break" my system. Thank you in advance for your help. Gael

0

The only address that systemd-resolved binds to is 127.0.0.53. To deploy a nameserver on a system which is running systemd-resolved as a local resolver, you should configure that DNS server to bind to the specific addresses or interfaces that you want it to listen on, excluding 127.0.0.53.

  • But with two DNS servers using port 53, there's a problem, and my answer disables the DNS stub in systemd-resolved... only needed with dnsmasq running at the same time... or other DNS servers. – heynnema Mar 8 at 21:34
-1

In a stock 18.xx system, DNS is managed by systemd-resolved.

Although this addresses a problem when dnsmasq and systemd-resolved are run at the same time, it should also solve your problem with CoreDNS...

Regarding dnsmasq and systemd-resolved...

Do a ps auxc | grep -i dns and ps auxc | grep -i resolv and look for dnsmasq and systemd-resolved, and if both are running, you need to disable the DNS part of systemd-resolved by editing /etc/systemd/resolved.conf and...

change:

#DNSStubListener=yes

to:

DNSStubListener=no

then restart systemd-resolve and dnsmasq, or reboot.


You MAY need to reset the symlink that is /etc/resolv.conf (if dnsmasq is not running)...

sudo mv /etc/resolv.conf /etc/resolv.conf.OLD # save the old symlink

sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf # create new symlink

Note: original symlink is...

sudo ln -s /run/resolvconf/resolv.conf /etc/resolv.conf

  • It is NOT necessary to disable the stub resolver in order to run your own DNS server, and doing so alters the resolution behavior for the host in ways that are not supportable by the Ubuntu developers. You should instead configure your DNS server to not bind to 127.0.0.53, which is the only address that resolved binds to. – slangasek Mar 8 at 21:05
  • @slangasek Actually, it IS necessary when you have two different DNS servers running on the same machine, as what can happen with both dnsmasq and systemd-resolvd... as they step on each others toes... and probably the same with CoreDNS and systemd-resolved. – heynnema Mar 8 at 21:10
  • @slangasek no need to down vote... – heynnema Mar 8 at 21:12
  • No, it is absolutely not necessary. Each server can bind to port 53 on the specific addresses that it should listen on. – slangasek Mar 9 at 23:32
  • @slangasek dnsmasq uses 127.0.0.1 and systemd-resolved uses 127.0.0.53... yet... when these are running at the same time, they step on each others toes, generate lots of syslog activity, and it's not until you configure DNSStublistener=no that it all works. I think the same for CoreDNS and systemd-resolved. – heynnema Mar 9 at 23:42

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.