[avahi] using Avahi in unaware applications

Norman Ramsey nr at eecs.harvard.edu
Wed Jun 21 08:55:04 PDT 2006


 > > 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

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'.

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).

  : 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?


Norman


More information about the avahi mailing list