[systemd-devel] Systemd-nspawn: cannot add interfaces with --network-interface flag

Lennart Poettering lennart at poettering.net
Wed Oct 8 05:08:07 PDT 2014


On Fri, 03.10.14 10:58, James Lott (james at lottspot.com) wrote:

> Hello,
> 
> A little bit back I wrote in about having some difficulties adding network 
> devices to containers. With some help from the list, I figured out how to add 
> my network devices to an already running container using 'iw phy' and 'ip 
> link'.
> 
> However, I have not yet successfully added an interface to a container by way 
> of the --network-interface flag. Attempting to add any ethernet devices by this 
> method meets with the error:
> 
> [root at host01 lanvpn]# systemd-nspawn --network-interface=eth1                                                                                               
> Spawning container lanvpn on /home/lanvpn.
> Press ^] three times within 1s to kill container.
> Failed to move interface eth1 to namespace: File exists
> 
> According to the systemd-nspawn documentation, it seems like this invocation 
> should work
> 
>        --network-interface=
>            Assign the specified network interface to the container. This will 
> remove the specified interface from the calling namespace and place it in the 
> container.
>            When the container terminates, it is moved back to the host 
> namespace. Note that --network-interface= implies --private-network. This 
> option may be used more
>            than once to add multiple network interfaces to the container.
> 
> If I'm doing something wrong, then it seems like the documentation may desire 
> revisiting. If I'm not, then this could be unintended behavior.

Which version of systemd-nspawn are you trying this with? Note that
there was a recent fix in the code handling --network-interface=, that
might make work what you are trying to do:

http://cgit.freedesktop.org/systemd/systemd/commit/src/nspawn/nspawn.c?id=3125b3ef5db70d45882c7d6f617705802c5f939e

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list