[avahi] libnss-mdns + avahi-daemon has strange behavior with many network interfaces

Lennart Poettering lennart at poettering.net
Fri Oct 6 16:04:41 PDT 2006

On Fri, 06.10.06 23:52, Christophe Nowicki (cscm at meuh.dyndns.org) wrote:

> Hi,
> I'am running avahi-daemon (version 0.6.13) on an computer with many network
> interfaces :
> # ifconfig | grep ^eth | wc -l
> 16

Are this real interfaces, or just "alias" interfaces? The output of
"ip link" is much more useful than ifconfig in this case.

> This computer has only one "good" network address (other addresses are
> used by vservers) :

What do you mean by "good"?

Please check syslog. avahi-daemon dumps the available interfaces and
ip addresses there and selects the "best" possible address for each
interfaces and uses it to publish the A record.

"best" in this case means that it uses an ip address with global scope
and outside of the ipv4ll range if existant, otherwiser falls back to
local scope/ipv4ll.

avahi will only use one ip address per interface.
> # ifconfig eth0
> eth0      Lien encap:Ethernet  HWaddr 00:11:95:25:DB:0C
>           inet adr:  Bcast:  Masque:
> mDNS services publishing is working very well :
> $ avahi-browse -a -r
> ...
> = eth1 IPv4 meuh [00:11:95:25:db:0c]                      Workstation     
>     local
>    hostname = [meuh.local]
>    address = []
>    port = [9]
>    txt = ["org.freedesktop.Avahi.cookie=1478531472"]
> But libnss-mdns does not resolve the *good* address :
> $ getent hosts meuh.local
>   meuh.local
> $ getent hosts meuh.local
>   meuh.local
> $ getent host meuh.local
>   meuh.local
> The network address returned by libnss-mdns is randomely selected within
> the network addresses used by the server.

If you compiled nss-mdns with avahi support (and passed the right
paths for avahi-daemons socket), than the results of "getent host" and
avahi-resolve-host-name should be identical.

Yes, it is not deterministic which IP address is returned by "getent
host"/avahi-resolve-host-name. This is not a bug.

> I think that would be nice to bind the avahi-daemon on a network interface
> with a directive in the avahi-daemon.conf file.

Yes, this is an often requested feature and is on our TODO list,
however, until now noone bothered to implement this.

Actually, it's amazing how often people ask this same question over
and over. We've added an item to our FAQ list, but apparently noone
even bothers to check that list first...


faq #10.


Lennart Poettering; lennart [at] poettering [dot] net
ICQ# 11060553; GPG 0x1A015CC4; http://0pointer.net/lennart/

More information about the avahi mailing list