Score:1

Ping to avahi device does not work all the time

es flag

I just added a NAS to my home network and gave it the hostname mynas. I tried to access the NAS from Kubuntu 20.04 (especially via Samba). It works fine when using plain hostname, but it fails when using "mynas.local".

I.e. ping mynas works fine, ping mynas.local does not.

I understand that .local names are resolved using Avahi/Zeroconf (Bonjour). So I run avahi-browse -at which properly locates the NAS. Immediately after that, ping mynas.local works fine – for a minute. Then it stops working until the next avahi-browse -at.

Is this a Kubuntu or a NAS problem? What can I do to permanently enable avahi name resolution?

Please note that the edits below were checked using a new Kubuntu 21.10 installation.

Edit: Content of /etc/nsswitch.conf

passwd:         files systemd
group:          files systemd
shadow:         files
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

Edit2: $ avahi-browse -at

+ enp5s0 IPv6 mynas                    Web-Angebot          local
+ enp5s0 IPv6 mynas                    Microsoft Windows Network local
+ enp5s0 IPv6 mynas                    Device Info          local
+ enp5s0 IPv4 mynas                    Web-Angebot          local
+ enp5s0 IPv4 mynas                    Microsoft Windows Network local
+ enp5s0 IPv4 mynas                    Device Info          local

Edit3: $ systemctl status avahi-daemon.service

avahi-daemon.service - Avahi mDNS/DNS-SD Stack
     Loaded: loaded (/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-12-30 23:27:10 CET; 2h 42min ago
TriggeredBy: avahi-daemon.socket
   Main PID: 46832 (avahi-daemon)
     Status: "avahi-daemon 0.8 starting up."

BTW the error I get on ping to mynas.local is "Temporary failure in name resolution"

Soren A avatar
mx flag
It is a user problem ... you probably haven't defined mynas.local anywhere.
es flag
So I have to explictely choose between mynas and mynas.local as a hostname? Well, if I choose "mynas" how can mynas.local ever work?
Soren A avatar
mx flag
I guess that you have defined mynas in `/etc/hosts` as `xxx.xxx.xxx.xxx mynas`. Add mysql.local kike this `xxx.xxx.xxx.xxx mynas mynas.local`. If you have defined the host-name in other ways (like in DNS) there are similar ways to define host-name aliases.
es flag
Didn't do anything like that. I only set the name of the NAS in two places: The hostname and the domain name. There is a description of the domain name that says "If you set a NetBIOS name like `synologynas` you will be able to access the device in your local network using a URL like `https://synologynas.local`". This implies that I do not need to add the `.local` explicitly.
user.dz avatar
ng flag
@Silicomancer If you are using IPv6 then, set `mdns6_minimal`(for IPv6-only) or `mdns_minimal` (for mixed IPv4 & IPv6). If you have multiple or dual interfaces that have common net for both devices, set avahi to work on only one `/etc/avahi/avahi-daemon.conf` using `allow-interfaces=` or `deny-interfaces=` settings see https://manpages.ubuntu.com/manpages/jammy/man5/avahi-daemon.conf.5.html . Make sure you have rebooted both machines after changing settings. Btw, they should be in same subnet (not router or subnet masking) that block some connections or firewall.
user.dz avatar
ng flag
@Silicomancer seems alright, when the `ping` fails before running `avahi-browse` , check if avahi daemon is running fine, using `systemctl status avahi-daemon.service`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.