What's new

mDNS name drifting on ZenWiFi XT8

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!


Regular Contributor
I've got this issue where the mDNS name of my router keeps changing or -should I say- increasing.

What do I mean by "mDNS name"?
One of my router's hostname is set to `ZenWiFi_XT8-Main`, so it's reachable at `zenwifi_xt8-main.local`, and this ".local" name is the mDNS name.

What is the problem?
As time goes by its mDNS name will gain a suffix like "-2" or "-3" and it keeps increasing slowly, so in order to reach it I need to access `zenwifi_xt8-main-2.local` and so on. (However the hostname `ZenWiFi_XT8-Main` is still accessible thanks to NetBIOS).

Also the following is in the log:
avahi-daemon[1924]: Host name conflict, retrying with ZenWiFi_XT8-MaBedroom-2
avahi-daemon[1924]: Host name conflict, retrying with ZenWiFi_XT8-MaBedroom-3
avahi-daemon[1924]: Host name conflict, retrying with ZenWiFi_XT8-MaBedroom-4
This keeps going on until the suffix reaches "-14".

Using a Bonjour browser, I can see that at this moment 2 of my 4 ZenWiFi XT8 are having this issue: the "Main" one and the "MaBedroom" one.

This is problematic for me because I use the router as a Time Machine backup server, and if the mDNS name changes, my Macs can't backup to the router.

Scope of this problem
This problem only occures on asus routers (currently on Other devices in my LAN (including a printer, Macs running macOS Catalina, iOS devices running iOS 13.4) do not have this problem.

One quick fix I can find is ssh into the router and run this command.
service restart_mdns

Is there a way to fix this once and for all?
Happens to me too! I saw it first when my MBP didn't make an backup for several days. I then had the prefix "-3". You can log in to the router and chose the ATM-disk again in ATM-settings and just press apply. It deletes the prefix "-3" and the disk will be reachable again. Much faster than restarting the router :)
I think SSH is a easier solution. I even devised a complicated solution for this problem around SSH.

I configured all my routers to send their logs to an `rsyslogd` instance running on my Mac Mini.
In the `rsyslog`, I added a rule that invokes a script to restart mDNS service on a router via SSH, when a log entry that indicates a hostname conflict is received from the router.
I also came up with a bash script that monitors the name drifting and restarts the mdns service accordingly. I changed the hostname of my routers using the `nvram` command to "ZenWiFi_XT8-Yard", "ZenWiFi_XT8-GuestRoom", ZenWiFi_XT8-Bedroom", and "ZenWiFi_XT8-Main". I left the script running inside a tmux terminal on my Mac Mini and drifting is no more. One can even run it with launchctl.
while read -r line; do
if [[ "$line" =~ [[:space:]]Add[[:space:]].*(ZenWiFi_XT8-(Yard|GuestRoom|Bedroom|Main)-[[:digit:]]+) ]] ; then
echo Found drifting mDNS name ${match[1]} ; echo ${match[1]}.local | ~/restart_mdns.sh ; else echo Ignore $line ;
done < <(dns-sd  -B _alexa._tcp  local.)

And inside `~/restart_mdns.sh` is just a way to ssh into the router and restart the service:
HOST=$(cat -)
PORT=#replace with ssh port for your router
USERNAME=#replace with your username
COMMAND="service restart_mdns"
IDENT_FILE=#replace with path to your ssh key
/usr/bin/ssh -o CheckHostIP=no -p $PORT -i $IDENT_FILE ${USERNAME}@"${HOST}" -- "$COMMAND"

The output looks like this:
Ignore Browsing for _alexa._tcp.local.
Ignore DATE: ---Sat 01 May 2021---
Ignore 3:33:43.494  ...STARTING...
Ignore Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
Ignore 3:33:43.630  Add        3   4 local.               _alexa._tcp.         ZenWiFi_XT8-GuestRoom
Ignore 3:33:43.630  Add        3   4 local.               _alexa._tcp.         ZenWiFi_XT8-Main
Ignore 3:33:43.630  Add        3   4 local.               _alexa._tcp.         ZenWiFi_XT8-Bedroom
Ignore 3:33:43.630  Add        2   4 local.               _alexa._tcp.         ZenWiFi_XT8-Yard
Ignore 9:53:42.251  Rmv        0   4 local.               _alexa._tcp.         ZenWiFi_XT8-Main
Found drifting mDNS name ZenWiFi_XT8-Main-4

Ignore 9:53:53.322  Rmv        0   4 local.               _alexa._tcp.         ZenWiFi_XT8-Main-4
Ignore 9:53:54.153  Add        2   4 local.               _alexa._tcp.         ZenWiFi_XT8-Main

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!