[systemd-devel] Systemd-nspawn -- Canot add interface to container

Marcel Holtmann marcel at holtmann.org
Thu Sep 25 01:21:16 PDT 2014


Hi James,

> I'm having another issue with private networking in systemd-nspawn. This one 
> I'm not so certain is a bug, but probably some kind of mistake on my part. 
> Base on my reading of the systemd-nspawn man page though, I can't figure out 
> what the problem is. Basically, all I'm tring to do is remove an interface 
> from the host namespace and provide it to the container. Details are included 
> below (This is systemd 216-r3 in Arch Linux ARM).
> 
> [root at host01 ~]# systemd-nspawn --network-interface=wlan0 -M1 -bD 
> /home/lanvpn/
> Spawning container 1 on /home/lanvpn.
> Press ^] three times within 1s to kill container.
> Failed to move interface wlan0 to namespace: File exists

actually netdev interfaces like wlan0 can not move into network namespaces by themselves. With wireless hardware, the underlying physical device (for example phy0) needs to move into the namespace. Which means that all netdev that belong to a specific phyX will move with it into the namespace.

Try using "iw phy <phyname> set netns <pid>" to achieve this.

Regards

Marcel



More information about the systemd-devel mailing list