[avahi] Resolve Local Hostnames using Aavhi

John Frankish j-frankish at slb.com
Fri Jun 10 02:55:43 PDT 2011



> -----Original Message-----
> From: John Frankish
> Sent: Sunday, 29 May, 2011 08:09
> To: 'avahi at lists.freedesktop.org'
> Subject: FW: [avahi] Resolve Local Hostnames using Aavhi
> 
> 
> > > > On 22/05/2011 18:08, John Frankish wrote:
> > > > I have a simple network using a cisco rvs4000 as a router and dhcp
> server.
> > > > Unfortunately, the rvs4000 does not have an option to resolve
> > > > local hostnames and I don't really want to leave a machine on
> > > > 24h/day running dnsmasq as a dhcp/dns server.
> > >>
> > > > Is there a way to use avahi to resolve local hostnames and to
> > > > assign hostnames to devices (ps3, internet radio, iphone) using
> > > > their mac address? I can see the information is there from
> > > > avahi-browse, but I don't seem to be able to get at it:
> > >>
> > > > $ sudo ping -c2 dslkayak [this is not the local machine]
> > > > ping: bad address 'dslkayak'
> > >>
> > > > $ sudo ping -c2 dslkayak.local
> > > > ping: bad address 'dslkayak.local'
> > >>
> > > > $ avahi-resolve -n dslkayak.local
> > > > dslkayak.local  192.168.1.100
> > > >
> > > > $ cat /etc/nsswitch.conf
> > > > hosts:      files mdns4_minimal [NOTFOUND=return] dns
> > > >
> > Hi John,
> > >
> > > I believe you need the following line in /etc/nsswitch.conf :
> > >
> > > hosts:      files mdns4_minimal [NOTFOUND=return] dns mdns4
> > >
> > > as described in the Documentation section at
> > > http://0pointer.de/lennart/projects/nss-mdns/
> > >
> > > Even though it says mdns4_minimal resolves .local addresses, it also
> > > says it resolves only IPV4LL addresses (169.254.x.x), which to me
> > > sounds like it doesn't resolve addresses from the private IPv4 range..
> > >
> > > Don't know if it's just not formulated well or if that's really the
> > > case. I'd give it a shot though.
> > >
> > Thanks.
> >
> > Indeed, the nss-mdns documentation does say that (I'd been looking at the
> avahi documentation).
> >
> > However, when I change nsswitch to:
> > files mdns4_minimal [NOTFOUND=return] dns mdns4 or even files mdns4
> > [NOTFOUND=return] dns
> >
> > The situation remains the same, i.e. avahi-resolve can find a machine by
> hostname, but ping cannot.
> 
> I double-checked that the kernel supports ip multicast and
> /etc/nsswitch.conf is as per the nss-mdns documentation.
> 
> Are there other settings I need to modify - /etc/hosts, /etc/resolv.conf - or is
> there any trouble-shooting I can try?

Problem found.

Avahi compiled with:

./configure --prefix=/usr/local --localstatedir=/var --with-distro=none --disable-qt3 --disable-qt4 --disable-gtk3 --disable-gdbm --disable-mono --with-avahi-user=tc --with-avahi-group=staff --with-avahi-priv-access-group=staff --with-autoipd-user=tc --with-autoipd-group=staff

$ strace ping..
...
connect(3, {sa_family=AF_FILE, path="/usr/local/var/run/avahi-daemon/socket"}, 110) = -1 ENOENT (No such file or directory)

avahi creates both /var/run/avahi-daemon and /usr/local/var/run/avahi-daemon, writes the pid and socket to /var, but looks for it in /usr/local/var.

symlinking ="/usr/local/var/run/avahi-daemon/socket -> /var/run/avahi-daemon/socket fixes the problem




More information about the avahi mailing list