[avahi] using Avahi in unaware applications
Lennart Poettering
lennart at poettering.net
Wed Jun 21 11:33:41 PDT 2006
On Wed, 21.06.06 11:55, Norman Ramsey (nr at eecs.harvard.edu) wrote:
>
> > > I've doctored my slogin and ssh scripts so that if they see a hostname
> > > of the form *.local, they will ask avahi-resolve to get the IP address.
> > > But what I would really like to do is somehow change my system resolver,
> > > so that *any* application will send .local requests to avahi and
> > > other requests to the standard DNS service. Does anybody know
> > > a way to change the resolver library, or to change the configuration
> > > for named, to make this happen?
>
> > You are after 'libnss-mdns'
>
> I have this installed, and I made the suitable change to my
> /etc/nsswitch.conf:
>
> > hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Please note that this line requires nss-mdns 0.8 to
work. Unfortunately, Debian unstable is still at 0.7.
The Debian maintainer seems to be vanished without a trace. At least
he hasn't responded to any of my emails recently and ignored my bug
report:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=369827
> And when I try 'getent hosts toller.local', as suggested in Lennart's
> documentation, it works nicely.
>
> But unfortunately, many applications appear not to use the glibc NSS
> functionality: neither curl, nor ssh, nor firefox see
> 'toller.local'.
Works fine here.
> Even worse, I must have my system configured badly (no cacheing?),
> because the time required to look up a *nonlocal* host is appalling.
> Notice the difference here between local and nonlocal lookup:
>
> : nr at toller 10706 ; time getent hosts toller.local
> 192.168.2.4 toller.local
>
> real 0m0.36s
> user 0m0.00s
> sys 0m0.00s
>
> : nr at toller 10705 ; time getent hosts toller
> 140.247.60.147 toller toller.eecs.harvard.edu
>
> real 0m10.01s
> user 0m0.00s
> sys 0m0.00s
>
> Ten seconds to look up a hostname! Whereas the same nonlocal lookup
> using host(1) is lightning fast (presumably exploiting a local
> cache).
Hmm, have you added .local to /etc/resolv.conf? If so every non-local
host name is first resolved with .local appended on mDNS. non-existing
mDNS hostnames will always cause the query to time out.
host(1) doesn't use any local cache. It uses unicast DNS, bypassing
NSS or anything.
>
> : nr at toller 10704 ; time host toller
> toller.eecs.harvard.edu A 140.247.60.147
>
> real 0m0.08s
> user 0m0.00s
> sys 0m0.00s
>
> This starts to look like a GNU NSS problem, not an Avahi problem, but
> I will refine my original question: is there some way to get my local
> DNS named (from bind9) to ask Avahi about hosts in the .local
> domain?
mDNS and unicast DNS are related but not really compatible. Such a
"link" between mDNS and unicast DNS would definitely be hack and
probably not worth the effort.
Lennart
--
Lennart Poettering; lennart [at] poettering [dot] net
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.net/lennart/
More information about the avahi
mailing list