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
-
1Have you tried to search? This looks like what you need https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu – marosg Mar 08 '19 at 13:58
-
Did you try my answer? – heynnema Mar 14 '19 at 02:39
2 Answers
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

- 70,711
-
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 08 '19 at 21:05
-
1@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 08 '19 at 21:10
-
-
No, it is absolutely not necessary. Each server can bind to port 53 on the specific addresses that it should listen on. – slangasek Mar 09 '19 at 23:32
-
1@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 09 '19 at 23:42
-
@heynnema thank you, the internal dns server of samba did not work until i applied your changes – Magnetic_dud Mar 31 '19 at 17:24
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.

- 5,562
-
1But 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 08 '19 at 21:34