1

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?

1 Answer 1

1

It's DNS. The search domain setting is causing this:

$ cat /etc/resolv.conf
nameserver 127.0.0.53
options edns0
search localhost

A router tricked Ubuntu into expanding names with a search domain that receives special treatment from systemd-resolved and as such breaks expected behavior:

The hostnames "localhost" and "localhost.localdomain" (as well as any hostname ending in ".localhost" or ".localhost.localdomain") are resolved to the IP addresses 127.0.0.1 and ::1.

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.

# /etc/NetworkManager/system-connections/WLAN
# ..
[ipv6]
ignore-auto-dns=true
# ..

Not a solution: edit /etc/dhcp/dhclient.conf (this configuration cannot supersede IPv6 Router Advertisment DNSSL)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .