Every time I should be getting an error because a domain does not exist (e.g. could not resolve host
), I instead get an error about connecting to a loopback address:
$ curl -4 -v https://nonexist.invalid
Trying 127.0.0.1...
The problem only starts occuring about 2 seconds after establishing a wireless connection. For a short time, all works as expected.
I am using systemd-resolved
and dns appears to be working:
$ readlink /etc/resolv.conf
../run/systemd/resolve/stub-resolve.conf
$ dig +short A example.com
192.0.2.1
$ dig +short A nonexist.invalid
$ systemd-resolve -t A nonexist.invalid
nonexist.invalid: resolve call failed: No appropriate name servers or networks for name found
If name resolution looks okay, why would programs still appear to be resolving names to 127.0.0.1
?
It's DNS. The search domain setting is causing this:
A router tricked Ubuntu into expanding names with a search domain that receives special treatment from systemd-resolved and as such breaks expected behavior:
Solution A: Reconfigure the router to send a more appropriate search domain
Solution B: disable automatic DNS configuration, e.g. in NetworkManager you can disable it just for either Ipv4 or IPv6 if the issue is limited to one. The corresponding option in the text config format is
ignore-auto-dns
.Not a solution: edit /etc/dhcp/dhclient.conf (this configuration cannot supersede IPv6 Router Advertisment DNSSL)