10

I have a Ubuntu 16.04 based HTPC/Media Server that's running 24/7. As far as I can remember using an official Ubuntu distro, I've always had issues with the avahi-daemon. The issue is pretty often discussed online. Some people decide to just delete daemon, however, I actually need it as I'm running a CUPS server and use Kodi as my AirPlay reciever.

The issue

mDNS/DNS-SD is inherently incompatible with unicast DNS zones .local. We strongly recommend not to use Avahi or ​nss-mdns in such a network setup. N.B.: nss-mdns is not typically bundled with Avahi and requires a separate download and install. (avahi.org)

The symptoms are simple - after around 2-4 days of uptime the network connection will go down and this will be logged

Mar 17 18:33:27 15 avahi-daemon[1014]: Withdrawing address record for 192.168.1.200 on enp3s0.
Mar 17 18:33:27 15 avahi-daemon[1014]: Leaving mDNS multicast group on interface enp3s0.IPv4 with address 192.168.1.200.
Mar 17 18:33:27 15 avahi-daemon[1014]: Interface enp3s0.IPv4 no longer relevant for mDNS.

The network will go back up without issues if you physically reconnect the Ethernet plug, or if you reconnect software-side.

Possible solutions

There are three solutions listed on the official wiki, which has been non-functional since what appears to be June 2016, so I'm providing a non-direct archive.org link

1.) Edit /etc/nsswitch.conf from

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

to

hosts: files dns mdns4

2.) Modify /etc/avahi/avahi-daemon.conf

from

domain-name=.local

to

domain-name=alocal

3.) "Ask the administrator to move the .local zone" (as said on the wiki)

What I did

The first solution did not appear to work for me - the daemon still works, however, the network will go down the same way as before (to be fair, on the wiki it does say "Your Mileage May Vary")

The second solution causes the daemon to seemingly function properly (nothing wrong if you look at the logs) but the iOS devices fail to "see" the machine as a printer or an AirPlay reciever (as well as iTunes on my Windows machine)

The third solution is tricky, because I'm not well versed in the "ins and outs" of how a network is functioning; and I'm not sure I actually tried it. Here's what I mean: on my Asus Router running Asuswrt-Merlin I went into a settings subcategory /LAN/DHCP Server/Basic Config. There I set "RT-AC68U's Domain Name" as "lan" (a domain name I saw advised on the web, because it doesn't conflict with anything, unlike "local"). As far as I can understand, that's what "moving the .local zone" means. If this is in fact correct, than this solution does not work for me as well.

Conclusion

So, what should I do? I've been battling with this problem for over 4 months now, and every answer online comes down to the those I've already tried; frankly, I'm completely lost. Thanks in advance!

  • This doesn't explain how you knew that avahi is the cause of "the network going down", as opposed to this log message being a symptom. See also unix.stackexchange.com/a/271412/29483 – sourcejedi Mar 18 '17 at 20:49
  • @sourcejedi Searching symptoms "network going down randomly" point to Ubuntu related boards that reference this issue, and most people there mention avahi being the problem. link – halfer Mar 19 '17 at 17:47
  • Wrong link, though I'm not going to argue about that. Nor about that search phrase not showing any such result for me, at least out of the first 10. From what you've written, I can only infer that you haven't tested removing avahi. Funny though, searching "Withdrawing address record" gives me several results about "network going down randomly" resolved as errors in hardware, none in avahi. 2) archive.org link in Q shows "No results found" for me. 3) which "does not work for me" applies to your third solution?, the implication is the result was the same as for #1, but it's not 100% clear. – sourcejedi Mar 19 '17 at 18:28
  • AFAICT Barton's answer is written under the assumption that your third solution causes some error with avahi/MDNS/bonjour resolution/discovery only, and does not cause the "network [connection] going down" problem. So it would be really good to clarify the symptoms you're seeing when you tried to apply the third solution! – sourcejedi Mar 19 '17 at 18:32
  • In your travails, for example, I suspect you've seen the answer here in your travails. Notice that the answer doesn't explicitly mention network failures, and the asker didn't accept the answer or say anything at all about what happened next. – sourcejedi Mar 19 '17 at 18:46
0

I think the third solution is the way to go when you have access to the router configuration. I would try setting the "RT-AC68U's Domain Name" to blank.

The next thing that I would do is run something like wireshark, and watch the packets sent and received by avahai-daemon, as well as any packets sent from and to any domain name ending in .local ... if something other than avahai is setting LAN domain names to .local you'll find it there.

It's also possible that the issue is something else entirely, and wireshark might tell you that as well.

If you're using Avahai entirely for the purpose of assigning domain names to machines on your network, you might consider using dnsmasq instead. You can run it off your RT-AC88U router, or from your Ubuntu box (In fact, it's probably already running on your ubuntu box, and you'll just need to tweak the config file).

Documentation for setting up dnsmasq under Asus-Merlin

  • Downvoted for suggesting that Avahi has a bug such that the "incompatibility" causes it to set the network interface offline at random intervals, because this is a mis-conception that seems to be spreading, with no specific evidence sourced for it. – sourcejedi Mar 19 '17 at 18:52
  • 1
    I'm using avahi to advertise the AirPlay and AirPrint service to Apple devices and software – halfer Mar 22 '17 at 20:10
0

So I tried to change the "host-name" parameter in "avahi-daemon.conf" to something that's not the machines hostname, and I've been running 2 weeks without any issues. Maybe this had to do with the machine also running samba and Windows using the ".local" domain for it's own purposes?

  • Windows / Samba do not assign a special meaning to ".local". (It's possible to use .s in netbios for some purpose though). avahi is enabled by default on ubuntu/fedora, and I've never seen a warning about running samba at the same time. I can't imagine why avahi-daemon would include any code which sets interface addresses or status. Thanks for coming back with your test result, I hope the setup keeps working from now on! – sourcejedi Apr 5 '17 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.