Avahi and dot-local addresses on Ubuntu Gutsy

I’ve noticed a problem with avahi and *.local addresses on ubuntu gutsy
– this will probably have cropped up on other distributions, or will do
soon. It is related to the similar Mac *.local problem.

It is thus: if you have avahi (aka zeroconf) installed, *.local
addresses are resolved via mDNS first. The default config of avahi is to
fail if mDNS is enabled and the host is not found in mDNS. This means
that you cannot resolve addresses under .local which are
in DNS but not mDNS.

To fix, edit /etc/nsswitch.conf and remove the text “[NOTFOUND=return]”
as follows:

hosts:          files mdns4_minimal dns mdns4
#hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4

You then need to restart the problem software. Avahi still works, but
will fail over to standard DNS if the host cannot be resolved via mDNS.

Alternatively, you can change the default suffix that avahi uses for mDNS, by adding the following to the [server] section of /etc/avahi/avahi-daemon.conf:


(H/T Josh McIntyre)