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

James Lott james at lottspot.com
Fri Oct 3 10:58:05 PDT 2014


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.


More information about the systemd-devel mailing list