systemd-resolved doesn't play well with dnsmasq cname entries

Bug #1951701 reported by Jeffrey Falgout
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
New
Undecided
Unassigned

Bug Description

See also https://community.ui.com/questions/USG-dnsmasq-cname-options-not-playing-well-with-systemd-resolved/11592045-d530-4f55-9cd2-9d45fc637e1d

I've set up my UniFi Security Gateway with dnsmasq so that I can resolve local hostnames on my network. I can resolve most hostnames, except for one: unifi.

$ nslookup unifi
Server: 127.0.0.53
Address: 127.0.0.53#53

** server can't find unifi.lan: SERVFAIL
$ nslookup unifi.lan
Server: 127.0.0.53
Address: 127.0.0.53#53

** server can't find unifi.lan: SERVFAIL

However, it works if I specifically query my router:

$ nslookup unifi 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53

unifi.lan canonical name = unifi.
Name: unifi
Address: 192.168.1.6
$ nslookup unifi.lan 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53

unifi.lan canonical name = unifi.
Name: unifi
Address: 192.168.1.6

So this seems specifically like a problem with systemd-resolved. Asking systemd-resolved to resolve these hosts is interesting:

$ systemd-resolve unifi unifi.lan
unifi: 192.168.1.6 -- link: wlp2s0

-- Information acquired via protocol DNS in 6.4ms.
-- Data is authenticated: no
unifi.lan: resolve call failed: No appropriate name servers or networks for name found

Following the steps [here](https://wiki.ubuntu.com/DebuggingSystemd#systemd-resolved_:_DNS_resolution_issues) I captured some systemd-resolved logs:

 - unifi.lan error: https://pastebin.com/pjzUvQfi
 - unifi success: https://pastebin.com/QN8hD9a1

And I found a setting in the router that seemed to be causing the problem. Removing that setting in my router resulted in this log:

 - unifi.lan success after deleting option cname: https://pastebin.com/4csYdW5B

But ultimately this seems like a bug in systemd-resolved since things seem to be working correctly if I take systemd-resolved out of the loop

$ lsb_release -rd
Description: Ubuntu 20.04.3 LTS
Release: 20.04
$ apt-cache policy systemd
systemd:
  Installed: 245.4-4ubuntu3.13
  Candidate: 245.4-4ubuntu3.13
  Version table:
 *** 245.4-4ubuntu3.13 500
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     245.4-4ubuntu3.11 500
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     245.4-4ubuntu3 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.