homebridge-keylights icon indicating copy to clipboard operation
homebridge-keylights copied to clipboard

Extremely frequent DNS queries from HomeBridge; some incorrectly formed

Open ericfitz opened this issue 3 years ago • 3 comments

Yesterday I noticed that my key light integration wasn't working. I unplugged and re-plugged in the key light, and it started working again.

As part of troubleshooting I also looked at the HomeBridge logs, which indicated frequent DNS queries for the key light. I then looked at my DNS server (a Pi-Hole) and was surprised to find that almost all of my DNS query traffic was HomeBridge querying for my key light.

DNS query volume last 24 hours Screen Shot 2022-10-06 at 1 17 13 PM Screen Shot 2022-10-06 at 1 17 40 PM

It appears that HomeBridge (or the Keylight plugin for HomeBridge) is querying for A and AAAA records for the discovered key light, every second, and is ALSO appending the local domain name (.local) and querying both again, every second.

So the problem is query volume. Querying once per second for multiple records is kind of overkill.

The second problem is that it's also appending the domain name when it already has an FQDN, and making multiple queries per second with names that cannot possibly work.

ericfitz avatar Oct 06 '22 17:10 ericfitz

I was able to suppress the DNS query volume by enabling the advanced configuration setting "Use IP address instead of hostname" in the Keylight plugin for HomeBridge. However this just works around the problem, it doesn't solve it, and I would prefer to use DNS names.

ericfitz avatar Oct 06 '22 17:10 ericfitz

This is definitely not intentional - can you provide a bit more information where your Homebridge is running? What OS and device are you running Homebridge on and how is DNS resolution handled?

Nothing in the plugin itself should trigger regular DNS queries, especially not that many. For now, I cannot reproduce this behaviour on my side.

As a test, can you try accessing the web interface of your keylight using the local domain?

jnmau avatar Oct 07 '22 10:10 jnmau

I run pi-hole as a DNS server, running on Raspbian Buster on Raspberry Pi 4B hardware.

pi@pi-hole:~ $ uname -a
Linux pi-hole.local 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux

Homebridge is running on a Raspberry Pi 4B running the Homebridge image for Raspberry Pi:

pi@homebridge:~ $ uname -a
Linux homebridge 5.15.61-v7l+ #1579 SMP Fri Aug 26 11:13:03 BST 2022 armv7l GNU/Linux

The key light is resolvable via DNS from the Homebridge instance:

pi@homebridge:~ $ ping elgato-key-light-2e1c
PING elgato-key-light-2e1c.local (192.168.1.173) 56(84) bytes of data.
64 bytes from elgato-key-light-2e1c.local (192.168.1.173): icmp_seq=1 ttl=255 time=10.9 ms
^C
--- elgato-key-light-2e1c.local ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 2.775/5.503/10.865/3.791 ms

pi@homebridge:~ $ ping elgato-key-light-2e1c.local
PING elgato-key-light-2e1c.local (192.168.1.173) 56(84) bytes of data.
64 bytes from elgato-key-light-2e1c.local (192.168.1.173): icmp_seq=1 ttl=255 time=12.0 ms
^C
--- elgato-key-light-2e1c.local ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 11.209/11.580/11.951/0.371 ms

The key light web UX is directly resolvable via DNS: Screen Shot 2022-10-07 at 6 45 39 PM

Let me know how I can help!

ericfitz avatar Oct 07 '22 22:10 ericfitz