How to move wireless connection to other network namespace?
You need to move the PHY:
iw phy phy0 set netns 666
Where 666 is the pid of some process running in that network namespace; for netspaces created by iproute2
tools (with ip netns
), you can create a short-lived process in there and get its pid:
iw phy phy0 set netns "$(ip netns exec mynetns sh -c '
sleep 1 >&- & echo "$!"')"
To move it back to the root namespace:
ip netns exec mynetns iw phy phy0 set netns 1