HAP-python icon indicating copy to clipboard operation
HAP-python copied to clipboard

Proper hostnames are constantly overwritten

Open avierck opened this issue 4 years ago • 0 comments

I'm having issues with dns resolution on my local network, and it may be due to either your code, or perhaps the implementation in home-assistant - although homebridge interestingly also gives the same problems. Heck, it might even be an issue with how my router (a Fritz!Box) is implementing DNS, I'm really not sure.

So if this issue should rather be reported in their respective repos, just let me know. I'm really hoping for a fast response here because right now, basically all my locally hosted services are randomly broken because of the unexpectedly unresolved hostnames.

The issue:

The DNS entries of two machines "randomly" change back and forth from their actual, proper hostname, thus making the machines unreachable on the network:

  • a Mac mini running home-assistant is supposed to have a FQDN of macmini.fritz.box (i.e. an advertised hostname of macmini.local), but that changes from time to time to 7070e420d09f4165a71680b4de84fe12-hap.fritz.box, where 7070e420d09f4165a71680b4de84fe12 apparently is home-assistant's core uuid that can be found in /the/path/to/.homeassistant/.storage/core.uuid.

    I suppose the relevant code section over at home-assistant can be found in this line, though I'm not completely sure.

  • a Raspberry Pi running a homebridge (so likely an issue with HAP-NodeJS too?) instance is supposed to have a FQDN of pi.fritz.box(i.e. broadcasted as pi.local), but that changes from time to time to something like 79_1E_6F_02_AA_79.fritz.box where the homebridge username (within homebridge's config.json file) would be 79:1E:6F:02:AA:79

Now my router (a Fritz!Box, but I suppose others would do the same?) is taking the advertised hostnames from hap-python seriously, and thus constantly changes the dns entries from their proper value (i.e. those that would be returned when running hostname in a shell) to these other values.

Out of interest, I ran dns-sd -G v4 macmini on my other Mac to track the changes to the hostname over time and it appears that each Homekit bridge instance I configured in home-assistant triggers a change, with approximately 3 minutes between each broadcast followed by approx. 25 minutes of the correct hostname being advertised:

DATE: ---Mon 13 Dec 2021---
 8:43:34.719  ...STARTING...
Timestamp     A/R    Flags if Hostname                               Address                                      TTL
 8:43:34.720  Add        2  0 macmini.fritz.box.                    192.168.178.3                                15
 8:47:56.204  Add        2  0 macmini.fritz.box.                    0.0.0.0                                      77   No Such Record
 8:47:56.238  Rmv        0  0 macmini.fritz.box.                    192.168.178.3                                0
 9:13:24.254  Add        2  0 macmini.fritz.box.                    192.168.178.3                                15
 9:16:56.285  Add        2  0 macmini.fritz.box.                    0.0.0.0                                      77   No Such Record
 9:16:57.522  Rmv        0  0 macmini.fritz.box.                    192.168.178.3                                0
 9:19:32.765  Add        2  0 macmini.fritz.box.                    192.168.178.3                                15
 9:21:12.338  Add        2  0 macmini.fritz.box.                    0.0.0.0                                      77   No Such Record
 9:21:12.383  Rmv        0  0 macmini.fritz.box.                    192.168.178.3                                0

Please let me know whether you need any more information from my side, or whether I'm actually reporting this issue in the right place.

avierck avatar Dec 13 '21 09:12 avierck