Is it valid to setup the container network in this way:
Create a dummy interface on the host
ip link add du0 type dummy
Created two containers using systemd-nspawn, each have a macvlan interface bind to that dummy interface
/etc/systemd/nspawn/proxy.nspawn and /etc/systemd/nspawn/apps.nspawn
[Network]
VirtualEthernet=no
MACVLAN=du0
I can't find any similar example on the Internet, I would like to know if it is good the use macvlan like that, or if there is a better method to achieve my goal.
My goal is to create a container that runs forward and reverse proxy. It will have multiple forward proxies that use different VPN interfaces to connect to different countries or use the physical interface directly. And all other containers will connect to that proxy container, each app will choose the appropriate proxy to use.
To connect those containers, systemd-nspawn support multiple options. I would like to use macvlan because it seems to be the most lightweight (best performance) among all options. But I want to ensure that the container cannot connect to the Internet directly, instead it must use the proxy container. I don't want to bind the macvlan interface to the physical interface. So I created a dummy interface on the host, and bind the macvlan interface to that dummy interface. I just tested it and it works, the container can ping each other.