You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[resolved] "search" domains not used for resolvectl low-level RR resolution #11325
When search domains are specified, lookup for e.g. "web001" should attempt lookup for e.g. "web001.example.com".
Unexpected behaviour you saw
No attempt to append ".example.com".
Steps to reproduce the problem
Domain and DNS settings as follows:
$ resolvectl domain
Global:
Link 17 (tun0): example.com
Link 16 (br1):
Link 15 (br0):
Link 13 (vnet1):
Link 12 (vnet0):
Link 5 (docker0):
Link 2 (eth0):
$ resolvectl dns
Global:
Link 17 (tun0): 10.15.11.64
Link 16 (br1):
Link 15 (br0):
Link 13 (vnet1):
Link 12 (vnet0):
Link 5 (docker0):
Link 2 (eth0):
Look up FQDN; success.
$ systemd-resolve -t A --search=true web001.example.com
web001.example.com IN A 10.15.24.221 -- link: tun0
-- Information acquired via protocol DNS in 143.1ms.
-- Data is authenticated: no
Look up unqualified name; failure.
$ systemd-resolve -t A --search=true web001
web001: resolve call failed: No appropriate name servers or networks for name found
As far as I understand, using systemd-resolve bypasses any potential issues in resolve.conf or nsswitch.conf. resolved.log
Sorry if there's already a bug open for this--I can't find one.
I have since discovered that this works if I omit the -t A. From the logs, it appears that systemd-resolved is doing an SOA lookup for example.com prior to appending .example.com to the hostname. I do not know why this happens, but apparently systemd-resolved considers it necessary, and using -t A restricts it from happening.
Thus, expected behavior would be that looking up an unqualified name via search will still work when specifying a record type.
resolved distuingishes RR lookups from hostnames/address lookups. The former being a low-level operation, the latter being a high-level operation. If you do the low-level operation the assumption is that you provide an fqdn already and no search domain extension is done. if you to the high-level operation the search domain logic is applied however. Hence what you are seeing is actually intended behaviour and I think it does make a lot of sense.
This is not unlike behaviour of "dig" btw, which doesn't do search list expansion either, and is a similar low-level RR lookup tool. In contrast to our tool "dig" does have an option however to turn on search domain logic.
Either way, I am not sure we should change behaviour here. However we probably should document this better. I hope that makes sense?
The behavior sounds reasonable too, but as a counterexample, the host tool appears to apply the domain search even when the record type is specified. Since the behavior does not seem universal, I would agree that some clarification in the man page could help.
...or, if possible, specifying both --search=true and -t should print an error.
blabla@blabla ~ $ host hostxx
hostxx.home.fantasy.bla has address 172.16.2.20
blabla@blabla ~ $ ping hostxx
ping: hostxx: Name or service not known
blabla@blabla ~ $ ssh hostxx
ssh: Could not resolve hostname hostxx: Name or service not known
blabla@blabla ~ $ systemd-resolve t A --search=true hostxx
t: resolve call failed: All attempts to contact name servers or networks failed
A: resolve call failed: All attempts to contact name servers or networks failed
hostxx: resolve call failed: All attempts to contact name servers or networks failed
blabla@blabla ~ $ systemd-resolve t A --search=true hostxx.home.fantasy.bla
t: resolve call failed: All attempts to contact name servers or networks failed
A: resolve call failed: All attempts to contact name servers or networks failed
hostxx.home.fantasy.bla: 172.16.2.20 -- link: br0
-- Information acquired via protocol DNS in 1.6ms.
-- Data is authenticated: no
Seems silly to put [!UNAVAIL=return] at the end. The lookup returns with the final status regardless of what happens.
I'm wondering if, after 5486a31, the [!UNAVAIL=return] is actually needed at all anymore. Host lookups through getent seem to work for me even with systemd-resolved not running and a (trimmed) nsswitch.conf of:
I have the same problem with a system configured to use a static IP. I specified a search domain in both /etc/systemd/resolved.conf and in the per-network file in /etc/systemd/network/enp1s0.network. resolved appears to make no attempt to use the search domain, or even DNS at all.
Here's the failed lookup for ping testhost: resolved.txt
And here's the successful lookup for ping testhost.example.com: resolved-fqdn.txt
The workaround of editing /etc/nsswitch.conf does work, but makes all DNS search domain lookups take longer than they should because it takes a while before the resolve step fails and the resolver falls back to the dns step.
I stepped through dns_query_go and the problem appears to be that in the manager for the network link, the first scope is the DNS_PROTOCOL_LLMNR one. When it calls dns_scope_good_domain, it notices a single name and returns DNS_SCOPE_YES_BASE + 1 (which has value 3) marking itself as authoritative for that name.
Next, dns_query_go tries the DNS_PROTOCOL_DNS scope. For that one dns_scope_good_domain notices that it's a single-label query and returns DNS_SCOPE_MAYBE (value 1). Since DNS_SCOPE_MAYBE < DNS_SCOPE_YES_BASE + 1, dns_query_go skips calling dns_query_add_candidate for the DNS scope.
The problem seems to have been caused by commit 1750854.
I was originally having some intermittent problems with the DNS search while I was connected to a VPN. I filed this ticket because I had difficulty troubleshooting and got stuck, and I haven't yet gotten back to troubleshoot more.
@aaronp24 , if the bug you described covers my original problem, then great! I don't know enough to be able to tell for sure without some deeper learning, but I'll keep an eye out.
A somewhat ugly and hasty workaround is to disable LLMNR lookups in /etc/systemd/resolved.conf. Of course as long as LLMNR is not required for a given network to work properly.
Activity
[-][resolved] search[/-][+][resolved] "search" domains not used for name resolution[/+]bugfood commentedon Jan 4, 2019
I have since discovered that this works if I omit the
-t A. From the logs, it appears that systemd-resolved is doing an SOA lookup forexample.comprior to appending.example.comto the hostname. I do not know why this happens, but apparently systemd-resolved considers it necessary, and using-t Arestricts it from happening.Thus, expected behavior would be that looking up an unqualified name via search will still work when specifying a record type.
poettering commentedon Jan 6, 2019
resolved distuingishes RR lookups from hostnames/address lookups. The former being a low-level operation, the latter being a high-level operation. If you do the low-level operation the assumption is that you provide an fqdn already and no search domain extension is done. if you to the high-level operation the search domain logic is applied however. Hence what you are seeing is actually intended behaviour and I think it does make a lot of sense.
This is not unlike behaviour of "dig" btw, which doesn't do search list expansion either, and is a similar low-level RR lookup tool. In contrast to our tool "dig" does have an option however to turn on search domain logic.
Either way, I am not sure we should change behaviour here. However we probably should document this better. I hope that makes sense?
bugfood commentedon Jan 7, 2019
Your explanation does make sense.
The behavior sounds reasonable too, but as a counterexample, the
hosttool appears to apply the domain search even when the record type is specified. Since the behavior does not seem universal, I would agree that some clarification in the man page could help....or, if possible, specifying both
--search=trueand-tshould print an error.Thanks,
Corey
dR3b commentedon Jan 9, 2019
Since the update to "systemd 240" I also have these problems!
dR3b commentedon Jan 9, 2019
Change this in /etc/nsswitch.conf:
falconindy commentedon Jan 10, 2019
Seems silly to put
[!UNAVAIL=return]at the end. The lookup returns with the final status regardless of what happens.I'm wondering if, after 5486a31, the [!UNAVAIL=return] is actually needed at all anymore. Host lookups through getent seem to work for me even with systemd-resolved not running and a (trimmed) nsswitch.conf of:
aaronp24 commentedon Jan 10, 2019
I have the same problem with a system configured to use a static IP. I specified a search domain in both /etc/systemd/resolved.conf and in the per-network file in /etc/systemd/network/enp1s0.network. resolved appears to make no attempt to use the search domain, or even DNS at all.
Here's the failed lookup for
ping testhost:resolved.txt
And here's the successful lookup for
ping testhost.example.com:resolved-fqdn.txt
The workaround of editing /etc/nsswitch.conf does work, but makes all DNS search domain lookups take longer than they should because it takes a while before the
resolvestep fails and the resolver falls back to thednsstep.aaronp24 commentedon Jan 11, 2019
I stepped through
dns_query_goand the problem appears to be that in the manager for the network link, the first scope is theDNS_PROTOCOL_LLMNRone. When it callsdns_scope_good_domain, it notices a single name and returnsDNS_SCOPE_YES_BASE + 1(which has value 3) marking itself as authoritative for that name.Next,
dns_query_gotries theDNS_PROTOCOL_DNSscope. For that onedns_scope_good_domainnotices that it's a single-label query and returnsDNS_SCOPE_MAYBE(value 1). SinceDNS_SCOPE_MAYBE < DNS_SCOPE_YES_BASE + 1,dns_query_goskips callingdns_query_add_candidatefor the DNS scope.The problem seems to have been caused by commit 1750854.
bugfood commentedon Jan 12, 2019
I was originally having some intermittent problems with the DNS search while I was connected to a VPN. I filed this ticket because I had difficulty troubleshooting and got stuck, and I haven't yet gotten back to troubleshoot more.
@aaronp24 , if the bug you described covers my original problem, then great! I don't know enough to be able to tell for sure without some deeper learning, but I'll keep an eye out.
Thanks,
Corey
thebodzio commentedon Jan 16, 2019
A somewhat ugly and hasty workaround is to disable LLMNR lookups in /etc/systemd/resolved.conf. Of course as long as LLMNR is not required for a given network to work properly.
aaronp24 commentedon Jan 16, 2019
I posted a pull request to revert the problematic part of the change, if you are willing to give it a try: #11425
poettering commentedon Jan 21, 2019
9 remaining items
resolvectl: clarify IDNA and search path logic in combination with "r…
resolvectl: clarify IDNA and search path logic in combination with "r…
resolvectl: clarify IDNA and search path logic in combination with "r…