[avahi] General Avahi usage questions

Lennart Poettering lennart at poettering.net
Wed Feb 17 06:45:59 PST 2010


On Wed, 17.02.10 15:18, Linus Lüssing (linus.luessing at web.de) wrote:

> > > Another question that comes in my mind here: What happens, if two
> > > computers have two different subnets configured which can't reach
> > > each other over this one but could reach each other over their
> > > ipv6 link local address as being on the same ethernet link.
> > > Shouldn't avahi announce this link local address as well so that
> > > those two hosts could communicate with each other anyway?
> > > Is there a reason why avahi is not announcing all ip addresses
> > > available on an interface (with adding its prefered priorities so
> > > that the another host could choose the interface with the highest
> > > priority stated and reachable as well)?
> > 
> > We want to minimize the traffic generated and hence pick only one
> > address per iface to announce, and that's the one that is probably the
> > most usefil one, i.e. a routable address. Anf if the routes mentioned
> > above are set up properly then things should be quire robust.
> Ah, that's a good point, yes. Makes sense to not announce all the
> ip-addresses then. Is there a way to not announce an IPv4 (or
> Ipv6) address on an interface to save some more traffic? I found
> those use-ipv4/6 options in the config, but they seem to be for
> the protocol being used fot the announcments, not the ip addresses
> being announced (unless I did something wrong here which might
> have led me to a wrong conclusion).

There's limited control for that with publish-aaaa-on-ipv4= and
publish-a-on-ipv6=.

> > > And I guess, avahi is announcing both the "best" ipv6 and ipv4
> > > address letting the other hosts decide which type they are
> > > capable connecting to, right?
> > 
> > Not sure I follow.
> > 
> > Avahi will pick the best address per interface and per protocol and
> > announce those. On a host with one network interface and both IPv6 and
> > IPv4 it will hence announce exactly two addresses.
> Or let me ask it differently. The other host is getting an
> annoucement of both an ipv4 and ipv6 address. Which one of those
> should the application then choose? Should it try the IPv6 one
> first and try again the Ipv4 address after a timeout? When getting
> the announcement over IPv4 (or IPv6) only, but with both an IPv4
> and IPv6 address in it, should the application then try to connect to
> the announced IPv4 (or IPv6) address first as that was the
> protocol over which it got the announcement and is having the more
> likely chances to succeed in connecting?
> Or should an application always try to use the IPv6 one first, as
> the connections should be a lot more stable because there are a lot less
> address collisions in IPv6 compared to IPv4 and therefore a lot
> less reassignments (if any) of IP addresses?

If you use getaddrinfo() you can leave the protocol to use unspecified
and then glibc will figure something out for you. It is highly
recommended to do things that way, and not add any IPv6-specific hacks
to applications.

Traditionally glibc will then first ask for IPv6 and then fallback to
Ipv4. With more recent glibc nss-mdns could actually ask for both
addresses at the same time, but I never found the time to actually
implement that in nss-mdns, so even with newer glibc you effectively
end up asking for ipv6 first and for ipv4 second.

Lennart

-- 
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4


More information about the avahi mailing list