How to reattach nic interface

I have a tap interface passed to a container using physical nictype.
Sometimes I need to restart the daemon that make the interface,which means it will be lost from container.
I don’t find a easy way(atleast documented) to reattach it to the container once available again.
Also is it possible to let incus monitor interface changes and automatically reattach the interface if required?

Also looks like allow-hotplug does not work in container. Might need other way to handle ip address .
[√] workarounded with netplug.

1 Like

Is it this one? GitHub - pali/netplug: Network link monitor daemon

Are you using a packaged version? The last modification of the code is about 20y ago

This workaround the dynamic ip address assignment for the hotplugged interface since allow-hotplug in systemd does not work in container, not the main problem.

1 Like

any news

systemd-networkd seems to handle that just fine, so if you must use ifupdown, you’ll probably have to workaround this with some udev rules or something in the container

Thanks. I already solved this particular one with netplug.

However the main problem still remains. I don’t find any doc on how to make incus automatically (or manually) re-attach such interface to containers when it comes up again.

I havent’t tried running the same device add command to re-attach it. if this works then maybe can add the command to the same netplug daemon running on host. But it’s still better if incus can support this out of box.

incus config device remove and incus config device add should work fine for this.