# Avahi and IPv6



## erikano (Dec 1, 2011)

I recently installed net/avahi and dns/nss_mdns on two of the machines on my LAN (my laptop, *triforce*, which has Xorg, and the server, *dev*, which is headless). Both have had their nss_mdns patched with patch-src_AAA-nss-mdns-linklocal.c from http://ensiwiki.ensimag.fr/index.php/Fixing_nss-mdns_for_IPv6_linklocal_scoped_addresses. Things are working out _quite_ well, but not _as_ well as I'd wish.

My main motivation for installing these two programs was to combat a problem I've been having. Under normal conditions, I'm very satisfied with how my LAN works.

I have globally routable IPv4 and IPv6 addresses assigned to me by my ISP via DHCP and stateless mechanisms respectively. I run my own DNS server (running on a machine external to the LAN) where I maintain A and AAAA records for the hosts on my LAN.

Whenever my internet connection drops out (thankfully, that's not very often but it happens), this obviously leaves me with a problem. I did consider setting up a DNS server on the LAN, so that it could always serve the IPv6 link-local addresses, but the problem then is that the clients must add their interface to the address (e.g. %rl0). I also thought about using /etc/hosts, but that scales badly.

After having installed avahi and nss_mdns, everything works out of the box, but only over IPv4. The things that work over IPv6 are certainly not "zeroconfig".

The fact that it requires IPv4 to work is problematic for two reasons:

1) When the internet connection drops out, I'm left with no routable IPv4-addresses and have to rely on the IPv6 link-local addresses.

2) All of the services I need support IPv6, and all the clients (my laptop and desktop) do as well, so I have no need for IPv4 on the LAN for internal communication among the machines.

ssh, curl and firefox all behave in the same manner; the IPv4 address is picked when it is available. When it is not, they fail.

In order to ensure that ssh always work, I added the following line to ~/.ssh/config for the hosts in question:


```
AddressFamily inet6
```

I can get around the problems with curl by telling it to only use IPv6, but that is annoying (and an alias won't do since I also use curl to retrieve data from the IPv4-enabled-only parts of the internet):

[cmd="erikano@triforce:~ $"]curl -6 dev[/cmd]

As for firefox, I have yet to find a way to make it work with the IPv6 addresses of the other hosts on the LAN, other than typing the address itself in square brackets (which defeats the purpose of having host names in the first place).

I also tried to specify 
	
	



```
use-ipv4=no
```
 in /usr/local/etc/avahi/avahi-daemon.conf to see if that might do the trick, but that only made it necessary to always use the "workarounds" mentioned above.

So what do I do now?

---

[cmd="erikano@dev:~ $"]uname -a[/cmd]

```
FreeBSD dev.rotas.info 8.2-RELEASE FreeBSD 8.2-RELEASE #0:
Fri Feb 18 02:24:46 UTC 2011 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
```

[cmd="erikano@dev:~ $"]pkg_info | egrep "^(avahi-[0-9]|nss_mdns|curl)"[/cmd]

```
avahi-0.6.29        The "meta-port" for the Avahi service discovery suite
curl-7.21.3_2       Non-interactive tool to get files from FTP, GOPHER, HTTP(S)
nss_mdns-0.10_2     NSS module implementing multicast DNS name resolution
```

[cmd="erikano@dev:~ $"]for i in $( echo /var/db/ports/{avahi,nss_mdns,curl}/options ) ; do cat $i ; echo ; done[/cmd]

```
# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for avahi-0.6.29
_OPTIONS_READ=avahi-0.6.29
WITH_AUTOIPD=true
WITHOUT_GTK=true
WITH_LIBDNS=true
WITH_MONO=true
WITHOUT_QT3=true
WITHOUT_QT4=true
WITH_PYTHON=true

# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for nss_mdns-0.10_2
_OPTIONS_READ=nss_mdns-0.10_2
WITH_SEARCH_DOMAINS=true

# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for curl-7.21.3_2
_OPTIONS_READ=curl-7.21.3_2
WITH_CARES=true
WITH_CURL_DEBUG=true
WITHOUT_GNUTLS=true
WITH_IPV6=true
WITH_KERBEROS4=true
WITH_LDAP=true
WITH_LDAPS=true
WITH_LIBIDN=true
WITH_LIBSSH2=true
WITH_NTLM=true
WITH_OPENSSL=true
WITH_CA_BUNDLE=true
WITH_PROXY=true
WITH_RTMP=true
WITH_TRACKMEMORY=true
```

[cmd="erikano@triforce:~ $"]uname -a[/cmd]

```
FreeBSD triforce.hybel.erikano.net 8.2-RELEASE FreeBSD 8.2-RELEASE #0:
Fri Feb 18 02:24:46 UTC 2011 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
```

[cmd="erikano@triforce:~ $"]pkg_info | egrep "^(avahi-[0-9]|nss_mdns|curl)"[/cmd]

```
avahi-0.6.29        The "meta-port" for the Avahi service discovery suite
curl-7.21.3_2       Non-interactive tool to get files from FTP, GOPHER, HTTP(S)
nss_mdns-0.10_2     NSS module implementing multicast DNS name resolution
```

[cmd="erikano@triforce:~ $]for i in $( echo /var/db/ports/{avahi,nss_mdns,curl}/options ) ; do cat $i ; echo ; done[/cmd]

```
# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for avahi-0.6.29
_OPTIONS_READ=avahi-0.6.29
WITH_AUTOIPD=true
WITHOUT_GTK=true
WITH_LIBDNS=true
WITH_MONO=true
WITHOUT_QT3=true
WITHOUT_QT4=true
WITH_PYTHON=true

# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for nss_mdns-0.10_2
_OPTIONS_READ=nss_mdns-0.10_2
WITH_SEARCH_DOMAINS=true

# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for curl-7.21.3_2
_OPTIONS_READ=curl-7.21.3_2
WITHOUT_CARES=true
WITH_CURL_DEBUG=true
WITHOUT_GNUTLS=true
WITH_IPV6=true
WITH_KERBEROS4=true
WITH_LDAP=true
WITH_LDAPS=true
WITH_LIBIDN=true
WITH_LIBSSH2=true
WITH_NTLM=true
WITH_OPENSSL=true
WITH_CA_BUNDLE=true
WITH_PROXY=true
WITH_RTMP=true
WITH_TRACKMEMORY=true
```


----------



## kpa (Aug 16, 2012)

My experience is exactly the same with net/avahi-app. It simply doesn't work with IPv6-only transport. As long as I have IPv4 connectivity between hosts the services show up fine on clients but as soon as I disable IPv4 in avahi-daemon.conf or configure the network as IPv6 only nothing gets advertised.


----------

