I'm trying to use dnsmasq on Ubuntu 20.04 and I get a port clash on port 53 with systemd-resolved. So I've found a few suggestions on solutions, but they seem to be dated or not applicable to my case.
If I disable systemd-resolved, everything comes to a crawl because I seem to be waiting for a timeout on:
sudo: unable to resolve host ubuntu: Temporary failure in name resolution
So basically any command I type takes 20 seconds or so.
I guess I need something like the suggestion to put dns=default in
/etc/NetworkManager/NetworkManager.conf like suggestion in https://askubuntu.com/a/907249. However, this file doesn't exist and is not part of the package anymore:
$ dpkg -S /etc/NetworkManager/NetworkManager.conf
dpkg-query: no path found matching pattern /etc/NetworkManager/NetworkManager.conf
So I post this as a 20.04-titled question instead of adding to 20+ comments there…
If I disable systemd-resolve I can start dnsmasq but everything still comes to a crawl with that "Temporary failure in name resolution" error and if I look at dnsmasq status it seems it has problems too:
ubuntu@ubuntu:~$ sudo systemctl status dnsmasq.service
sudo: unable to resolve host ubuntu: Temporary failure in name resolution
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2020-10-22 11:20:35 UTC; 1min 8s ago
Process: 36231 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
Process: 36232 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
Process: 36241 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/S>
Main PID: 36240 (dnsmasq)
Tasks: 1 (limit: 9024)
CGroup: /system.slice/dnsmasq.service
└─36240 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg->
Oct 22 11:20:35 ubuntu dnsmasq[36240]: using nameserver 127.0.0.53#53
Oct 22 11:20:35 ubuntu dnsmasq[36240]: read /etc/hosts - 7 addresses
Oct 22 11:20:35 ubuntu systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.
Oct 22 11:20:37 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Oct 22 11:20:48 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Oct 22 11:20:57 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Oct 22 11:21:07 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Oct 22 11:21:17 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Oct 22 11:21:27 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Oct 22 11:21:37 ubuntu dnsmasq[36240]: Maximum number of concurrent DNS queries reached (max: 150)
Is it so that dnsmasq now delegates to non-running 127.0.0.53:53 according to above logs?
With systemd-resolved running I had:
$ sudo ss -lp "sport = :domain"
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 0 0 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=36111,fd=12))
tcp LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=36111,fd=13))
And with systemd-resolved disabled but dnsmasq running I have:
sudo ss -lp "sport = :domain"
sudo: unable to resolve host ubuntu: Temporary failure in name resolution
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
udp UNCONN 18432 0 0.0.0.0:domain 0.0.0.0:* users:(("dnsmasq",pid=36240,fd=4))
udp UNCONN 0 0 [::]:domain [::]:* users:(("dnsmasq",pid=36240,fd=6))
tcp LISTEN 0 32 0.0.0.0:domain 0.0.0.0:* users:(("dnsmasq",pid=36240,fd=5))
tcp LISTEN 0 32 [::]:domain [::]:* users:(("dnsmasq",pid=36240,fd=7))
I have:
$ cat /etc/resolv.conf | grep nameserver
nameserver 127.0.0.53