Replies: 8 comments 2 replies
-
Continuing discussions from home-assistant/addons#3416 (comment)
@PaulSD these suggestions pretty much match with what I had in mind. One thing we need to keep in mind is how do we deal with existing add-ons and how can we minimize the user impact for people which do not need/want this feature. At first I thought this could be an add-on configuration: An add-on opt-in to But thinking a bit more about it, I start to feel that this should be an alternative option for |
Beta Was this translation helpful? Give feedback.
-
Continuing discussion from home-assistant/addons#3416 (comment)
Far point, one could argue macvlan is not the right tool/is over-engineered for that problem at hand. I guess my point here is if we build feature, presumably mainly for other reasons than simply network interface selection, we could use it as a generalized way of providing interface selection to add-ons. 🤔 I guess distinct IPs for external use is more a necessary side effect of the isolation, than really something I am looking for here. But it might also come in handy when debugging, e.g. it would make it easy to monitor the traffic of a add-on with host network access by simply filtering by IP.
I am not very familiar with swconfig or DSA, but isn't this for actual switch hardware? I don't think this can be used on arbitrary hardware. |
Beta Was this translation helpful? Give feedback.
-
I would not support this, unless it was touchless like today. Adding IPv6 for internal traffic is a great idea but not at the expense of the user experience. |
Beta Was this translation helpful? Give feedback.
-
I think Macvlan is a very useful tool to have in the bag. I run my HA this way, and I much prefer it to host network mode. One of the reasons we need to carry a patch in HAOS is because running something like OTBR and matter server together in the same network namespace is sort of undefined behaviour under RFC 4191. According to the kernel maintainers, routers are not supposed to have the neighbour validity checking the matter server needs to not have 30 minute outages all the time. If we could run OTBR under Macvlan, I think we might not hit that edge case in RFC 4191 and we wouldn't need that patch? I also wonder whether the TREL route loop that needed an OTBR patch would have behaved differently under that kind of setup? |
Beta Was this translation helpful? Give feedback.
-
Seeing that since Feb there haven't been any more activity here. So what is the current state of affairs here on the macvlan integration in HA? To make my own point a bit more clear, since I am one of the HA add-on developers which would highly benefit from being able to utilize macvlan functionality, I want to point out again that from a technical point of view a per-addon macvlan already works in HA. Just have a look at the support patch/script I have created for my users (cf. https://github.com/jens-maus/RaspberryMatic/wiki/Installation-HomeAssistant#hmip-haphmipw-drap-support-patch and https://github.com/jens-maus/RaspberryMatic/blob/master/scripts/patch-ha-addon-macvlan.sh). Executed on a HA host, this simple bash script generates the necessary docker networks (https://github.com/jens-maus/RaspberryMatic/blob/master/scripts/patch-ha-addon-macvlan.sh#L90-L94) and then simply assigns a static IP and connects the add-on docker container to this new macvlan based docker network. So from my point of view, implementing add-on based macvlan support could/should be implemented in a rather simple and add-on centric way:
Therefore, I think that a general or more broad/global macvlan functionality is not really required in HA itself. IMHO add-on developers like me should know best if their add-on requires this special functionality. Thus, a simple So looking forward to seeing something similar being integrated in one of the next HA/supervisor versions so that my users (who require this functionality) can finally get rid of this workaround support patch which they have to re-execute on each add-on restart or HA restart. :) |
Beta Was this translation helpful? Give feedback.
-
Problem statement
Add-ons (in Supervisor based installations, so Home Assistant OS or Supervised) run by default in isolated network environment in a common, internal network named
hassio
. Each add-on gets its own internal IP address and applications can reach the user's local network and the internet via NAT.Optionally, add-on developers can request host network access via the
host_network
add-on configuration option.The isolation provided by these two options are in rather stark contrast: On one hand the default networking isolates the add-on to a large degree from the user's local network, on the other hand using
host_network
option has no isolation at all and gives add-on full access to the hosts network interfaces, along with management interfaces like thehassio
network itself, which is often not of interest for the add-ons and adds to confusion and issues at times.Over time, various advanced networking needs have arisen by different type of add-ons:
.local
addresses as well.Almost all use-cases can (and typically are) solved by simply using host network, however, with the downside of having no isolation and higher chance of add-ons interfering with each other.
Another networking need comes from multi-homed hosts: Often users would like to offer services only for a particular network (interface). E.g. the DHCP add-on allows to configure the interface it hands out leases to. The Samba add-on listens on all interfaces by default, but that might not be ideal for all use cases. The OpenThread Border Router add-on uses the primary interface as deemed by the NetworkManager as backbone/infrastructure link.
While most services allow to define the network interface they listen on, some listen on any interface by default. E.g. the Matter Server listens to mDNS/DNS-SD announcements on any interface without a built-in option to limit the interfaces used. Since this is mostly a passive listen-only, this is not that problematic. However, currently this behavior creates some log noise since the host network has also virtual interfaces from all containers, which do not have IPv6 addressing enabled:
This architecture discussion aims to discuss these needs and find a better solution which fulfills many of the above mentioned requirements. The goal is to strike a good balance between capability, usability and usefulness of such a feature.
Possible solution
Add macvlan support to Supervisor
One possible solution could be to support macvlan support to Supervisor. Docker offers the
macvlan
network driver which allows to add a virtual network interface with a separate MAC address which is bridged to the physical network interface. Since this is a separate L2 virtual network interface, it needs its own IP configuration. By default static IP configuration is available from Docker.Implementing
macvlan
support could be done in various ways in HA: In a simple version we could just add a "virtual network" configuration page in the add-on, and allow the user to manually configure a macvlan interface. A more advanced version of this would allow multiple macvlan interfaces per add-on.Even more advanced would be a common place to create a named "virtual network" which would allow to add multiple macvlan interfaces along with the network configurations for each one of those. These then could be attached to add-ons.
Downsides:
Upsides:
Beta Was this translation helpful? Give feedback.
All reactions