how does one put the main ethernet interface on Ubuntu server into macvlan mode automatically (i.e. for every boot and not just on the command line)?
Background and reason:
If someone wants virtual containers such as LXD or docker to appear on the network like physical machines, there is two options:
a) create a virtual bridge device and put all virtual machines and the host itself into that bridge. Works, but is said to be slow and have unnecessary overhead for keeping the bridge alive, such as timeouts, dynamic mac tables and so on.
b) use macvlan interfaces, which work like a bridge, but much faster and simpler, since the do not need all that overhead of maintaining a network bridge. Works, except for a particular problem:
The problem is, that the host itself cannot communicate with the guest, although LXD and docker put the macvlan devices into "bridge" mode, which is explicetely designed to allow communication between all virtual interfaces on the same physical interface.
Unfortunetaly, there is no good documentation on macvlan, even docs.kernel.org covers only ipvlan.
However, I found hints that the commication between host and guest in a macvlan type network with mode bridge only works if the host's interface is in macvlan mode as well.
Unfortunately, Ubuntu Server heavily relies on netplan, which does not seem to support macvlan.
I therefore have two questions:
1.) Can the physical device (like eth0 or enp4s0) itself be put into macvlan mode, or is this possible only for virtual devices?
2.) In either case: What is the recommended and Ubuntu-compliant way to configure Ubuntu server such that the host gets an (either physical or virtual) macvlan network device to be able to communicate with its guests in macvlan mode?
And yes, I've seen the former question MACVLAN Bridge in netplan and bug https://bugs.launchpad.net/netplan/+bug/1664847 but this is from 2019 and applies to 18.04, so probably not valid anymore since it recommends to use ifup/ifdown. On the other hand, there is some rough workaround using networkd-dispatcher and scripting.
But is there a clean way?
regards