-
Notifications
You must be signed in to change notification settings - Fork 653
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default mDNS settings results in network flooding #5435
Comments
Following up on this: as expected, the change does not persist so before I looked at the logs this morning, the system-resolved service had a chance to try 55K times. Next I'm going to see if I can execute the command on boot somehow. If this doesn't work, then... maybe it's time to roll out my own supervisor. |
I ended up creating a custom add-on for this. It monitors the primary interface at regular (configurable interval) and if mdns is not "resolve" on the primary (configurable too) interface, then it changes mdns automatically. If anyone is interested, I'm willing to share but at least for now this will do the trick. |
Hey there :) I stumbled on this Thread here because my HA is using 30% CPU constantly and I was searching for a reason why. After scrolling through Logs I saw the Spamming of Hostname Conflicts. Can this be related to the CPU usage? If yes, I absolute would love to have your Add-On for this. High CPU Usage means High Electricity costs and here in Germany its expensive :D Thank you a lot! |
Problem is originated from this line:
|
Just to be clear, from what I can tell, the mDNS responder systemd-resolved behaves exactly how it is designed to behave: It uses the link-local mDNS protocol to announce its hostname, and validates the uniqueness on the network. The mDNS protocol is clearly defined as link-local only in RFC6762. Handling name conflicts is not explicitly specified, but mentioned too as possible behavior. The "issue" here is that mDNS reflectors are a hack to extend mDNS outside of the link-local context. This is operating mDNS clearly outside of the specified context! I am not aware of a RFC which would define mDNS reflector behavior, and how a multi-homed host should behave in the face of looped back mDNS announcements. FWIW, mDNS reflector also do not work if a device has IPv6 link-local addressing ( That said, I understand that such Unifi network setups are quite popular. If folks feel comfortable to run mDNS in an non-standardized setup and deal with potential fallout (like this, I guess 🙈 ) I am fine adding features to help make Home Assistant work in such environments. Also keep in mind that you ask for a specific behavior which suits your specific network setup. I use VLANs as well, but without mDNS reflectors. I actually want Home Assistant to announce itself on every network. |
Btw, at least at one point Core itself also didn't like duplicate mDNS instances (see home-assistant/core#50695). Now I think today this no longer leads to a packet flood, but there is probably still an error in the logs in these setups. |
I guess me setting up a reflector actually defeats one of the original intent of reducing IoT broadcast packets such as the ones from mDNS amongst others. I am starting to lean towards a dedicated ethernet for the VirtualBox guest running home assistant so I can plug it on a dedicated VLAN port on my switch. At a bare minimum I could move home assistant to the IoT VLAN. I am fine with turning off the reflector and keep all the esphome devices on the IoT VLAN, but I am not sure about other possible issues this could bring. For instance, how do you have home assistant "announce itself on every network"? |
Yeah I think Home Assistant (the service) announces itself only on the primary interface currently. But since I have my phones etc. on the primary interface for me that is fine. |
If you'd be willing to share that would be awesome. I get it's a bandaid, but right now I'm just trying to keep everything stable until a better options comes. (thanks for the quick PR - I wish I knew how to make something like that happen so quickly!) I'm also open to other solutions. Right now I have an IOT VLAN (no egress for most devices via firewall rules) and a Chromecast VLAN, as well as my main VLAN. HAOS sits on IOT and Main. Perhaps I could turn off mDNS on my Unifi USG, and put HAOS on the Chromecast VLAN as well. I haven't experimented with that, and only understand mDNS a little. Ultimately my goal is segregated network for the IOT devices, and everything to work. |
I have the same setup with HA on normal LAN and second interface on IOT VLAN. mDNS reflector/repeater was the solution, but triggered the above mentioned problem. I'm interested in the add-on too, so I could use mDNS again. |
I went ahead and blocked mDNS on all except my main HOAS network interface via my router. No more log overload. |
We should monitor #5455 In the meantime, I went on a learning journey and created the following addon for anyone to use as a duck tape solution EDIT: Hold on with the installation please. It looks like I need to resolve a couple of issues with the published version; local was just fine |
Thank you! Will hold tight for now. |
ok Fixed. You can try now. The logs should output something like this:
If a change was needed, logs will indicate it. This typically occurs the first time the addon is executed and later when updates are installed (I believe only supervisor updates will do this, but I could be wrong). hope this will help someone while a real fix is being worked on! |
This is great, I've just started using this to reduce the noise in the logs. How do you configure a primary interface to use? |
By default, the add-on binds to the primary interface. You can check the documentation on the add-on where everything is explained as I could |
Just to add to this, I'm ha ving the same issue using opnsense and mdns repeater. Will try the add on provided but I feel hass should really clear things regarding the current state of support for multi nic, there's problem that seems to be around for some time, like this one or the "default" network interface flapping between those available even if you select only one of the interface the supervisor can select another one and from my experience this can change.. |
I've noticed this too. I haven't concluded that it is causing a problem, although the only time I notice is when I'm into troubleshoot something networking related. It usually seems to sort itself out and assign the correct interface as "default", but it seems like that should be able to be manually defined. I've also noticed that even though I disable a network interface in the HA settings, it will become re-enabled at some point. (Just checked, and my third interface is set to automatic again when I am certain I said it too disabled a couple days ago - perhaps it happens when I do a reboot). |
Describe the issue you are experiencing
The default NetworkManager configuration sets mDNS to
yes
which, in network having multiple vlans and a reflector (e.g. on a Unifi network), result in a flood of mDNS requests originating from the supervisor's systemd-resolved. I believe the network configuration originates from this line:https://github.com/home-assistant/supervisor/blame/4e0de93096dc69c257056b36eff0c19b47006850/supervisor/dbus/network/setting/generate.py#L167
Typical flooding would look like this
The issue was also reported under the operating system project, but got closed. Nevertheless, a long discussion continued after the issue got closed, with some hints on how to fix the issue.
home-assistant/operating-system#1163 (comment)
What type of installation are you running?
Home Assistant OS
Which operating system are you running on?
Home Assistant Operating System
Steps to reproduce the issue
...
Anything in the Supervisor logs that might be useful for us?
System Health information
System Information
Home Assistant Community Store
Home Assistant Cloud
Home Assistant Supervisor
Dashboards
Recorder
Spotify
Supervisor diagnostics
config_entry-hassio-5dae251bf6ea118d92a240060ae3caf8.json
Additional information
In the meantime, I am trying the solution proposed in the following comment
home-assistant/operating-system#1163 (comment)
Which for me was as follow, while connected through ssh.
1- List all connections
2- Set mdns mode to resolve on the Supervisor connection
> nmcli connection modify "Supervisor enp0s3" connection.mdns resolve
3- Restart Network Manager
> systemctl restart NetworkManager.service
4- Confirm it works
I am wondering if this is something that could be exposed to the UI, or if someone has a better solution?
The text was updated successfully, but these errors were encountered: