mdns hostnames (other devices on the network) incrementing at vastly faster rate since installing avahi (and scrypted).
Issue: Hostnames (of other devices on the network) are incrementing (to combat perceived conflicts), but incremeting substantially faster than they used to. Breaks some browsing and home automation that I would like to do. Many devices on the network, but 2 iPhones and an appletv consistently increment their hostnamesmuch more often than the rest of the Bonjour devices. Example: my HomePod mini is on like name-3.local, but my iPhone is on name-659.local and I had reset it. It has climbed much higher. Restarting my router helps. Renaming hostnames on iPhone helps. But always temporary.
Unfortunately, I lost my history that had my latest set of logs and troubleshooting, but I was able to save my ssh session, which captures my avahi conf, the contents of avahi-browse, iOS log regarding networking (mdns debugging profile enabled- the rest of the logs stripped out because it's a personal device) and output of syslog and dmesg from device avahi is installed on.
Logs are just under 50 mb and I can't upload them. Do you have a server or share I can drop them to?
If you can tell me the exact logs you need, I will reproduce all of it and generate appropriate logs from the same time (right now I'm just hobbling to get you some data).
Hardware:
Qotom box running untangle firewall
3x tplink eas 245v3 Wi-Fi access points
3x tplink smart switches
2x vlans, 1x management
Avahi and scrypted running on a Linux Mint mini pc.
172.25.10.1 is router
172.25.10.132 is avahi host
When trying to test IoT network, I put my iphone on 172.25.69.0/24 subnet, and my testing is printing to my brother laser printer. I consider it a success when I can print to my laser printer from the 69 subnet (it's on 172.25.10.0/24)
joshua_iphone, katie_iphone are the biggest offenders for the hostname increments.
Some devices increment hostname a lot. Others not a much, but ideally, I'd love for it to stay with its original hostname.
Rebooting router temporarily fixes. Renaming hostname from impacted device temporarily fixes. Do not have any devices that share the same hostname that conflict with each other. Firewall logs don't show much, but do show the traffic on 5353 Wireshark does show malformatted packets with some mdns traffic. Tons of packets, more than I would expect.
Let me know a specific test and what logs you'd like and I will send them your way. I suspect devices going to sleep and waking up with a stale avahi cache entry can trigger renames. I suspect the malformed packets could trigger renames. Have always had this happen when I implemented vlans, but substantially much slower. Where it might be my iphone-4.local and not iphone-1729.local
Going through the iPhone logs after installing the mdns logging profile from apple. I do see when the hostname changes, but so far no clues as to why.
@adriancable it's not the best set of logs, but I was able to capture my ssh session into my box that hosts avahi. Please let me know when you grab the logs so I can remove them from my share.
Also, please give me an example of a specific use-case and what logs you want and I'll attempt to regenerate them all during the same test over the weekend.
I just wanted to get this opened since you asked me and I would not get it opened otherwise, leaving it to be forgotten.
https://www.icloud.com/iclouddrive/0a4TNTKv5j_1XVvZxohGQAimg#avahi
@diothar - most useful is the Avahi logs in debugging mode.
For this to include everything needed, you will first need to edit your avahi-daemon.service to enable debugging. You will find the file somewhere under /etc/systemd. You will then find lines that look like this:
ExecStart=/usr/sbin/avahi-daemon -s
ExecReload=/usr/sbin/avahi-daemon -r
You will want to add --debug to the end of each line, like so:
ExecStart=/usr/sbin/avahi-daemon -s --debug
ExecReload=/usr/sbin/avahi-daemon -r --debug
Then do systemctl daemon-reload. Then wait for it to happen again (several times is best), then do journalctl --no-pager -u avahi-daemon -n 500 and post the results.
Also, you should clarify your original post that you are talking about hostnames of other devices on your network when you are using Avahi as a reflector, not of the Avahi host. This distinguishes your issue from others posted here.
For the sake of posterity, this is what I found when looking for the avahi-daemon.service
joshua@datto:/etc/systemd/system/multi-user.target.wants$ ls -al lrwxrwxrwx 1 root root 40 Jun 29 22:58 avahi-daemon.service -> /lib/systemd/system/avahi-daemon.service
I added debugging, will restart my untangle router to get the counts down to 0 and will capture for a while. To be clear, you're not really needing a pcap, logs from the router (doesn't really show much aside from the traffic on on 5353, or even iphone mdns debug logs)?
also, I updated the title to reflect this is hostname incrementing on other devices ut the mdns reflecting is achieved through avahi.
In the first instance, the Avahi log will be enough - no pcap needed.
Sorry, I threw out my back a few days ago. Please don’t close this- I just need a few more days to get back on my feet.
@adriancable apologies- I was out of commission for a few days. However, I might have cracked this, testing now.
I originally installed avahi-daemon on my ubuntu VM, but I could never get avahi to reflect to my second vlan/subnet. Not sure why. So the mdns hostname resolution wasn't working for my IoT devices. That's when I abandoned my attempts to install it on my VM and I got ahold of a mini pc and installed linux mint. This is where my current avahi-daemon service is running (and working across subnets).
Anyway, I had a power outage a few weeks ago and hadn't noticed that avahi-daemon auto started on my Ubuntu VM when it came back up.
Rebooting the router, manually updating the hostname on my iphone and macs.... let's see if disabling the rogue avahi-daemon service helps. (I reset the hostname on my iphone a few days ago and it's now almost 5-digits long, joshua-iphone-12345.local for example)
Have you built the branch that should fix this? https://github.com/lathiat/avahi/tree/117-spurious-name-conflicts
That completely resolved this issue for me when using avahi-daemon's reflection feature with Apple devices.
Coincidentally, I also use Untangle, but that shouldn't matter. Also, the issue will exist whether you use Homebridge or Scrypted or not. However, you will likely find 117 fixes it.
@diothar I wonder if reflect-ipv was set to yes at the time? With that setting enabled avahi reflects probes back and it's apparently enough to totally confuse systemd-resolved for example:
Oct 04 03:16:28 C2 systemd-resolved[858]: Detected conflict on C2373.local IN A 192.168.85.136
Oct 04 03:16:28 C2 systemd-resolved[858]: Hostname conflict, changing published hostname from 'C2373' to 'C2383'.
Oct 04 03:16:28 C2 systemd-resolved[858]: Detected conflict on C2383.local IN A 192.168.85.136
Oct 04 03:16:28 C2 systemd-resolved[858]: Hostname conflict, changing published hostname from 'C2383' to 'C2391'.
Oct 04 03:16:28 C2 systemd-resolved[858]: Detected conflict on C2391.local IN A 192.168.85.136
Oct 04 03:16:28 C2 systemd-resolved[858]: Hostname conflict, changing published hostname from 'C2391' to 'C2399'.
Oct 04 03:16:28 C2 systemd-resolved[858]: Detected conflict on C2399.local IN A 192.168.85.136
Oct 04 03:16:28 C2 systemd-resolved[858]: Hostname conflict, changing published hostname from 'C2399' to 'C2402'.
Oct 04 03:16:29 C2 systemd-resolved[858]: Detected conflict on C2402.local IN A 192.168.85.136
Oct 04 03:16:29 C2 systemd-resolved[858]: Hostname conflict, changing published hostname from 'C2402' to 'C2410'.
It could have also been caused by the issue fixed in https://github.com/lathiat/avahi/pull/263 but I assume that patch was backported before reporting this (those conflicts didn't accumulate that fast though). Either way it's hard to tell what the issue is with no configs/logs/pcaps.
Closing because of lack of response. If it's still reproducible with the avahi reflector >= 0.8 with #263 included please open a new issue and attach configs/logs/pcaps.
Wireshark does show malformatted packets with some mdns traffic
Malformed packets are tracked in https://github.com/lathiat/avahi/issues/379