Monday, February 23, 2009

Enabling IPv6 support in Avahi (Zeroconf/Bonjour)

Avahi (http://avahi.org/wiki/AboutAvahi) is already installed out of the box on all recent Linux distributions, to enable IPv6 for this service make sure the /etc/avahi/avahi-daemon.conf file contains an active "use-ipv6=yes" line.

To enable m(ulticast)dns resolving of IPv6 addresses change the
"hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4"
line to
"hosts: files mdns_minimal [NOTFOUND=return] dns mdns"
in the /etc/nsswitch.conf file

You probably have to restart nscd if used (/etc/init.d/nscd restart or service nscd restart)

Every IPv6 enabled host using Avahi/Zeroconf/Bonjour should now be pingable as hostname.local and visible using the avahi-discover utility

To add the .local domain as standard domain for dns queries you could add a "search local" to resolv.conf and the host is now pingable as just hostname.

Another useful option for users with a mixed Linux/Microsoft environment is to enable Microsoft hostname resolving by changing the line in /etc/nsswitch.conf to
"hosts: files mdns_minimal [NOTFOUND=return] dns mdns wins", just make sure to install winbind on the Linux host.

2 comments:

Quirinius said...

And it does not only work for ping6, but also for ssh, traceroute6 and even http.

The important thing is not to forget the ".local" at the end. (Unless, of course, you also change resolv.conf)


sander@linuxmint6 ~ $ ping6 ubuntu810-on-athlon64.local
PING ubuntu810-on-athlon64.local(ubuntu810-on-athlon64.local) 56 data bytes
64 bytes from ubuntu810-on-athlon64.local: icmp_seq=1 ttl=64 time=12.5 ms
64 bytes from ubuntu810-on-athlon64.local: icmp_seq=2 ttl=64 time=2.59 ms
64 bytes from ubuntu810-on-athlon64.local: icmp_seq=3 ttl=64 time=2.93 ms
^C
--- ubuntu810-on-athlon64.local ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2006ms
rtt min/avg/max/mdev = 2.592/6.033/12.574/4.627 ms
sander@linuxmint6 ~ $

Anonymous said...

Thank you for this post. It helped me with some trobles with pidgin 2.7.3 when avahi chat does not work because of some ipv6 black magic. But instead of enabling that evil wizardry v6 I needed to disable it.