New install in VM cannot ping or ssh any local machines using hostname.local

I just installed EndeavourOS Cassini Nova in Virtual Box. My host is Zorin OS 16.2.

I cannot ping or ssh into any local machines using hostname.local. Both ping and ssh work when I use IP addresses.

ssh -vv pi@backup.local
OpenSSH_9.3p1, OpenSSL 3.0.8 7 Feb 2023
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving “backup.local” port 22
ssh: Could not resolve hostname backup.local: Name or Service Not Known

ping -c 3 backup.local
ping: backup.local: Name or Service Not Known

By comparison, from my host machine (Zorin OS 16.2), I can both ssh and ping using local hostnames (i.e. backup.local).

QUESTIONS:
(1) How do I get ssh and ping to work for local machines, i.e. hostname.local?
(2) Is this networking problem related to having EndeavourOS in a Virtual Machine? Would I not have these problems if I was on bare metal?

Are you using bridged or nat networking in your VM?

NAT.

Should it be Bridged?

I would try switching to bridged so you are on the same network as the rest of your devices.

When it is nat, there is a separate network created for the VMs.

I switched to Bridged, but ping is still getting “Name or service not known”.

Are you using the same DNS servers on the host and the VM?

[~]$ systemd-resolve --status
...
DNS Servers: 1.1.1.1 8.8.8.8

This is the same output for my host and my endeavour VM.

For some reason, resolved.service was not running.

I enabled it:

[~]$ systemctl enable systemd-resolved.service

After a restart, I get this new error code. I ran it as verbose to get more info:

[~]$ ping -v backup.local
ping: sock4.fd: 3 (socktype: SOCK_DGRAM), sock6.fd: 4 (socktype: SOCK_DGRAM), hints.ai_family: AF_UNSPEC
ping: backup.local: Temporary failure in name resolution 

Why not ping the hostname backup instead of backup.local ?

If the hostname backup.local has the top-level domain name .local , you need to enable avahi to resolve this top-level domain .local by default.

  1. Enable avahi
    $ sudo systemctl enable --now avahi-daemon.service

  2. Disable systemd-resolved to prevent the conflict with other DNS avahi
    $ sudo systemctl disable --now systemd-resolved.service

  3. Test: Disable any firewall without a headache.

  4. Wait more than 1 min for avahi process or reboot.

It might be useful (if there is access) to check how the router/AP sees the connections.

I had a similar problem had to edit the /etc/nsswitch.conf file as described in https://wiki.archlinux.org/title/Avahi

Had to add “mdns_minimal [NOTFOUND=return]”

1 Like