Multiple hosts on your network with the same mdns name

What happens when you have multiple hosts on your network with the same mdns name?

mDNS handles naming collisions through a process called “probing and announcing” defined in RFC 6762. Here’s how it works:

Collision Detection Process:

  • When a device wants to claim a name (like “ansibledest.local”), it first “probes” by sending queries for that name
  • If another device already has that name, it responds, indicating a collision
  • The new device must then choose a different name, typically by appending a number (ansibledest-2.local, ansibledest-3.local, etc.)
  • This process repeats until an unclaimed name is found

In practice- I haven’t seen this behavior, exactly. The devices all come online and if you run the hostname command, each of them thinks they’re Spartacus. You have to ping a specific ip address to get the updated mdns name in your cache. Annoying:

RFC 6762 told me I was good!

Well- I know the host is online apparently. I wonder what happens if I ping the hostname again-

It works. hooray.

Identifying duplicate mdns entries

You can use the avahi-browse command to see what’s up on your network. The hosts are apparently doing some kind of incremental naming- but not in a way that provides tcp/ip utility.

avahi-browse -at | grep ansibledest*
+ wlp0s20f3 IPv6 ansibledest-4 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv6 ansibledest [mac:addy:du:jour]              Workstation          local
+ wlp0s20f3 IPv6 ansibledest-3 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv6 ansibledest-3 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv6 ansibledest [mac:addy:du:jour]               Workstation          local
+ wlp0s20f3 IPv6 ansibledest-2 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv6 ansibledest-2 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv4 ansibledest-4 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv4 ansibledest-2 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv4 ansibledest-3 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv4 ansibledest-2 [mac:addy:du:jour]             Workstation          local
+ wlp0s20f3 IPv4 ansibledest [mac:addy:du:jour]               Workstation          local
+ wlp0s20f3 IPv4 ansibledest [[mac:addy:du:jour]               Workstation          local