Resolving .local hostnames has become slow since updated from 18.04 to 20.04. Things as simple as:

ping flibble.local

work immediately in 18.04 but take about 5 seconds or so in 20.04. After which it behaves normally. However, it still takes another 5 seconds when run again.

I haven't customized anything since updating. If it matters Ubuntu is running as a VM in Parallels. I can provide details as necessary.

My /etc/nsswitch.conf file contains the usual:

hosts:          files mdns4_minimal [NOTFOUND=return] dns myhostname

I've tried searching for solutions to this problem, but nothing so far has fixed it.

systemctl status systemd-resolved.service output:

● systemd-resolved.service - Network Name Resolution
     Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-10-05 09:55:47 PDT; 10min ago
       Docs: man:systemd-resolved.service(8)
   Main PID: 592 (systemd-resolve)
     Status: "Processing requests..."
      Tasks: 1 (limit: 7061)
     Memory: 9.4M
     CGroup: /system.slice/systemd-resolved.service
             └─592 /lib/systemd/systemd-resolved

Oct 05 09:55:47 invasion-ubuntu20 systemd[1]: Starting Network Name Resolution...
Oct 05 09:55:47 invasion-ubuntu20 systemd-resolved[592]: Positive Trust Anchors:
Oct 05 09:55:47 invasion-ubuntu20 systemd-resolved[592]: . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d
Oct 05 09:55:47 invasion-ubuntu20 systemd-resolved[592]: Negative trust anchors: 10.in-addr.arpa 16.172.in-addr.arpa 17.172.in-addr.arpa 18.172.in-addr.arpa 19.172.>
Oct 05 09:55:47 invasion-ubuntu20 systemd-resolved[592]: Using system hostname 'invasion-ubuntu20'.
Oct 05 09:55:47 invasion-ubuntu20 systemd[1]: Started Network Name Resolution.
Oct 05 09:55:47 invasion-ubuntu20 systemd-resolved[592]: Using degraded feature set (UDP) for DNS server
  • Maybe it could be the /etc/resolv.conf file that is in use. There are a couple to choose from. Maybe instead of using the stub-resolv.conf try using the resolv.conf. The files are located in /run/systemd/resolve/ and they are links in the /etc folder. sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf – Terrance Oct 3 at 19:38
  • thanks for the suggestion. I tried both of the files in /run/systemd/resolve/, but unfortunately neither helped. fwiw /etc/resolv.conf is currently symlinked to ../run/resolvconf/resolv.conf – Bill Barton Oct 4 at 2:13
  • I think I just figured something out here. I have 20.04 as well. When I look at my router, my network has a .lan name, but that is beside the point here. I see on my router that I have some DHCP reservations setup for systems on my network. Any of those will ping right off the bat without even adding the .lan name at the end of them. Others in my DHCP Leases that are not part of the reservations actually take up to about 5 seconds before they ping back. Just a thought. – Terrance Oct 4 at 3:30
  • I have a system with a DHCP reservation too, and its hostname takes just as long to resolve as other names. BTW, I just timed it. It's a 10-second delay. – Bill Barton Oct 5 at 16:34
  • domain names that are resolved by actual DNS (e.g., google.com) resolve in under 100ms. – Bill Barton Oct 5 at 16:36

Looks like the solution might be to not depend on nss-mdns at all. I was unfamiliar with systemd-resolved, which appears to have mdns resolution capability. It appears to outperform nss-mdns. However, mdns in systemd-resolved appears to be off by default. Here's how I activated it and deactivated nss-mdns.

Change /etc/nsswitch.config

hosts:          files dns myhostname

Edit /etc/systemd/resolved.conf


Create new /etc/NetworkManager/conf.d/mdns.conf containing


Restart NetworkManager:

sudo service NetworkManager restart

Might also need to restart systemd-resolved

sudo service systemd-resolved restart

Test results with:

resolvectl mdns

When it's working:

Global: yes
Link 2 (enp0s5): yes


time ping -c1 invasion.local

completes in under 150ms.

| improve this answer | |

In addition to Bill Barton's excellent answer which helped me quite a bit, I also had to disable IPV6 in my configuration. Machines that had IPv6 enabled would still resolve quickly. If I tried to ping a machine that didn't have IPv6 enabled, like my Nas4Free server, it would take around 5~10 seconds before the ping would start responding. NSLookup was the same.

I followed the instructions on How to disable IPv6 address on Ubuntu 20.04 LTS Focal Fossa - LinuxConfig.org to disable IPv6 on my Ubuntu 20.04 machine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.