[systemd-devel] Systemd-nspawn -- Canot add interface to container
James Lott
james at lottspot.com
Thu Sep 25 09:49:47 PDT 2014
Hi Marcel,
Thanks for the help pointing that one out! With your guidance I was able to
figure out that I'll need to run something like:
iw phy phy0 set netns <pid>
Unfortunately I'm having some trouble trying to figure out the network
namespace PID to assign the phy0 interface to. Although I definitely have
containers with private networking running, I can't view any information about
their network namespaces
[root at host01 lanvpn]# machinectl
MACHINE CONTAINER SERVICE
0 container nspawn
lanvpn container nspawn
2 machines listed.
[root at host01 lanvpn]# ps aux | grep -v grep | grep systemd-nspawn
root 143 0.0 0.3 2884 728 ? Ss 08:42 0:00
/usr/bin/systemd-nspawn --network-bridge=switch1 -bD /home/proxy -M 0
root 4438 0.0 0.6 2884 1128 pts/3 S+ 09:15 0:00 systemd-
nspawn --private-network
[root at host01 lanvpn]# ip netns list
[root at host01 lanvpn]#
Any nudges in the right direction are welcome, and appreciated!
On Thursday 25 September 2014 10:21:16 Marcel Holtmann wrote:
> 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