Note - this article assumes you have reasonable familiarity with systemd
, networkd
and nspawn/machinectl
There seem to be a lot of references on the internet for nspawn networking with a bridge - but not on simply using the stock veth
networking with static addresses. The default behaviour of nspawn
(as of 24/03/20 and systemd:245
on Arch) is to:
- Make a virtual ethernet port on the host (defined by
/lib/systemd/network/80-container-ve.network
) - Make a virtual ethernet port in the container (defined by
/lib/systemd/network/80-container-host0.network
) - Based on those configurations, serve the host port a random IP from the local network ranges with a 28 bit subnet, and a DHCP server for the host port serves a random IP in the subnet to the container