[systemd-devel] Systemd-nspawn networkd configuration

Lennart Poettering lennart at poettering.net
Tue Nov 10 06:28:09 PST 2015


On Tue, 10.11.15 15:17, Dmitry Kulida (vbnz at bk.ru) wrote:

> Hi guys!
> 
> I'm running few systemd-nspawn containers with veth network interfaces. I'd
> like to configure separate subnet for each container but all I've found in
> config files is using DHCP server for each container and no option to use
> fixed IP/SUBNET for each container. Could anyone please help to find option
> to configure exact IP/SUBNET for each container instead of system
> address/subnet selection?
> 
> 
> 80-container-ve.network
> [Match]
> Name=ve-*
> Driver=veth
> 
> [Network]
> # Default to using a /28 prefix, giving up to 13 addresses per container.
> Address=1.1.1.0/30
> LinkLocalAddressing=yes
> DHCPServer=yes
> IPMasquerade=yes


Add a couple of separate files: 80-container-foo.network,
80-container-bar.network, 80-container-waldo.network, ... and then
make sure the [Match] section matches against exactly the veth link
towards one specific container, and configure the IP address range for
each one individually in the Address= line.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list