Ping can't resolve local hostname with avahi

1,557 views
Skip to first unread message

Trillien

unread,
Mar 26, 2017, 1:03:03 PM3/26/17
to al...@googlegroups.com
Hello,

I'm facing an issue as I'd like to use Avahi feature on Alt-F RC5 running on a DNS-320L.
My wish is to use mDNS functionality to discover the other devices on my local network. I'll then be able to connect them using their hostnames instead of their dynamic IP addresses.

avahi_daemon is started on boot.
I checked the result of avahi-browse -a
$ avahi-browse -a
+   eth0 IPv4 DLINK                                  _ssh._tcp            local
+   eth0 IPv4 DLINK                                  _smb._tcp            local
+   eth0 IPv4 DLINK                                  _sftp-ssh._tcp       local
+   eth0 IPv4 DLINK                                  _nfs._tcp            local
+   eth0 IPv4 Secure Alt-F webUI on DLINK            _https._tcp          local
+   eth0 IPv4 DLINK [xx:xx:xx:xx:xx:xx]              _workstation._tcp    local


and avahi-resolve --name dlink.local
$ avahi-resolve --name dlink.local
DLINK
.local      192.168.0.23


I got the expected feedback: avahi discovers the devices and can resolve local hostnames.
However ping dlink.local failed resolving the address.
$ ping dlink.local
ping
: bad address 'dlink.local'


I checked avahi_daemon was still running:
$ sudo /etc/init.d/S50avahi_daemon status
avahi
-daemon running


So I'm there: avahi perfectly works but I guess the resolv rules don't include avahi results to resolve local hostnames. I found this can be tuned by the file /etc/nsswitch.conf which is linked to libnss-mdns. But I understood through this forum Alt-F doesn't use glibc (including libnss-mdns). So my try to create the file /etc/nsswitch.conf had no effect.

Have you got an idea on how to solve local hostnames resolution?

Trillien

SystemConf.log

João Cardoso

unread,
Mar 26, 2017, 2:48:45 PM3/26/17
to Alt-F


On Sunday, 26 March 2017 18:03:03 UTC+1, Trillien wrote:
Hello,

I'm facing an issue as I'd like to use Avahi feature on Alt-F RC5 running on a DNS-320L.
My wish is to use mDNS functionality to discover the other devices on my local network. I'll then be able to connect them using their hostnames instead of their dynamic IP addresses.

Avahi-daemon warns you in syslog:

 Mar 26 18:37:55 DNS-320L daemon.warn avahi-daemon[3004]: WARNING: No NSS support for mDNS detected, consider installing nss-mdns!

And as you already know uclibc doesn't support nss

There is an old patch for this that is not used under Alt-F: http://lists.busybox.net/pipermail/buildroot/2012-March/052338.html

+nss-mdns is an extension to glibc to support resolution of link-local
+(.local) addresses via GNU Name Service Switch (NSS) which redirects
+the queries to a running avahi-daemon, which in turn does the resolution
+via multicast DNS (mdns).
+
+However, this does not work for uClibc, as it does not support NSS.
+
+This patch integrates the nss-mdns approach into uClibc's resolver,
+so getaddrinfo() and getnameinfo() calls get redirected to a running
+avahi-daemon before trying to resolve via unicast DNS.

So I don't see a solution for you.

Alt-F supplies the host name when making a DHCP request:

[root@DNS-320L]# ps | grep udhcp
udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0 -r 192.168.1.68 -x hostname DNS-320L

and my router's DHCP/DNS server honors it, so I can use the box host name on any pc on my network.
If the issue is your router, perhaps you could use 'dnsmasq' running in the box, instead of your router's dhcp server (and avahi on the box)? I remember doing that and it worked.
Reply all
Reply to author
Forward
0 new messages