Skip to content

stub resolver (127.0.0.53) and systemd-resolve have different defaults for search domains #5051

Closed

Description

@Gamberoni

Submission type

  • Bug report
  • Request for enhancement (RFE)

Or gotcha, perhaps.

systemd version the issue has been seen with

231

Used distribution

Kubuntu 16.10, with local changes to use systemd-resolved instead of dnsmasq for local dns caching.

In case of bug report: Expected behaviour you didn't see

Same and expected results from any way of resolving an unqualified hostname when a search domain is configured: append the search domain to the hostname and resolve the resulting FQDN.
I expect a dig <hostname_without_dots> to resolve with the search domain(s) appended.
This is what dnsmasq, systemd-resolve and libnss_resolve do.

In case of bug report: Unexpected behaviour you saw

The stub resolver provided by systemd-resolved at 127.0.0.53 differs: it behaves strictly according to dig documentation: man dig states
+[no]search Use [do not use] the search list defined by the searchlist or domain directive in resolv.conf (if any). The search list is *not* used by default.'
The surprise arises from long exposure to dnsmasq as local dns cache behaviour.
I would not have submitted this bugreport if systemd-resolve and libnss_resolve were consistent with their stub resolver, but they adopt dnsmasq behaviour, so the expectation is not only mine.

In case of bug report: Steps to reproduce the problem

Have systemd-resolved running, no local dnsmasq active, the backend libnns_resolve for glibc nss installed and configured in /etc/nsswitch.conf. Have some dns search domain active.

$ cat /run/systemd/netif/state 
# This is private data. Do not parse.
OPER_STATE=routable
DNS=192.168.139.1
NTP=192.168.139.1
DOMAINS=lan

Here I have a "lan" search domain, handed out by the dhcp server implemented by an OpenWrt router.
The hostname of the router is "tplink"
This is unexpected:

$ dig @127.0.0.53 tplink # FAILURE, unexpected.
; <<>> DiG 9.10.3-P4-Ubuntu <<>> @127.0.0.53 tplink
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 57749
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;tplink.                                IN      A

;; Query time: 790 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Jan 09 16:13:58 CET 2017
;; MSG SIZE  rcvd: 35

in the following context:

$ dig +short @127.0.0.53 gateway
192.168.139.1

$ dig +short @127.0.0.53 tplink.lan 
192.168.139.1

$ dig +short +search @127.0.0.53 tplink
192.168.139.1

$ systemd-resolve tplink
tplink: 192.168.139.1
        (tplink.lan)

$ systemd-resolve --search false tplink
tplink: resolve call failed: No appropriate name servers or networks for name found

$ systemd-resolve --search false tplink.lan
tplink.lan: 192.168.139.1

$ getent hosts tplink
192.168.139.1   tplink.lan

Activity

  1. piotr-dobrogost commented on Jan 10, 2017

    @piotr-dobrogost

    How does your /etc/resolv.conf look like? Is it a symlink? What's the output of systemd-resolve --status?

  2. Gamberoni commented on Jan 10, 2017

    @Gamberoni
    Author
  3. Gamberoni commented on Jan 11, 2017

    @Gamberoni
    Author

    In the above, the fact that I am trying to resolve the name of an OpenWrt router is important: it is a system NOT responding over LLMNR protocol.
    The stub resolver on 127.0.0.53 resolves unqualified hostnames ONLY through LLMNR protocol, it succeeds if the name refers to a machine within the broadcast domain which is responding to LLMNR queries (such as another machine running systemd-resolved).

  4. piotr-dobrogost commented on Jan 11, 2017

    @piotr-dobrogost

    The stub resolver on 127.0.0.53 resolves unqualified hostnames ONLY through LLMNR protocol (...)

    Do you infer this from the following statement from man systemd-resolved (emphasis mine):

    Single-label names are routed to all local interfaces capable of
    IP multicasting, using the LLMNR protocol.

    ?

  5. Gamberoni commented on Jan 11, 2017

    @Gamberoni
    Author
  6. piotr-dobrogost commented on Jan 25, 2017

    @piotr-dobrogost

    Still, I would appreciate some plain words in addition as I'm not sure what's going on :) How does using resolvconf help here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions