The end goal is to have a macvlan interface set up within a Podman container. I have the following Dockerfile
FROM docker.io/library/debian:bookworm-slim
RUN apt-get --yes install systemd
RUN systemctl set-default multi-user.target
CMD ["/lib/systemd/systemd"]
If I then run this in privileged mode (detached) and attach a shell to the running container (as root), I can set up a macvlan interface called macvlan1 on the default tap interface using iproute2:
# apt install iproute2
# ip link add macvlan1 link tap0 type macvlan mode bridge
However, I want to avoid this, and I think it should be possible using systemd-networkd, but I'm not having much luck. I've tried the following .network and .netdev files (which I have tested to work on my host machine):
### 99-test.network
[Match]
Name=tap0
[Network]
MACVLAN=macvlan1
### 99-test.netdev
[Match]
# Empty
[NetDev]
Name=macvlan1
Kind=macvlan
[MACVLAN]
Mode=bridge
I update my Dockerfile like so:
FROM docker.io/library/debian:bookworm-slim
COPY 99-test.network /lib/systemd/network
COPY 99-test.netdev /lib/systemd/network
RUN apt-get --yes install systemd
RUN systemctl set-default multi-user.target
RUN systemctl enable systemd-networkd
CMD ["/lib/systemd/systemd"]
But when I start up the container, I see no macvlan interface created. If I look at the output of systemctl status systemd-networkd there are no logs or error messages suggesting that it's attempted to read the .network and .netdev files. The only clue I have is that when I run networkctl on my host machine, it shows the physical interfaces as unmanaged in the SETUP column whereas in the container, it shows all interfaces as pending (including for a manually-created macvlan interface).
Is what I'm trying to do possible with systemd in Podman? If not, why not?