If I move an interface temporarily into a netns with
ip link set eth10 netns myns
then it no longer is visible in the root, only within the namespace myns.
How do I move it back, something like (these obviously don't exist):
ip link unset eth10
or perhaps
ip link set eth10 netns root
or similar?
I found an answer. Sure, you cannot do it from within the netns. But, if you execute
ip netns exec ....
from within the root network namespace, it all works.Then it works! It takes the PID (1 in this case) to which we are assigning it to be in the context of the executing command (wrapper) before we enter the netns. Done!
You can use the
ip netns delete
function. From the man page:It can not be used for all purposes, but it's definitely the easiest route.
What worked for me based on deitch's answer is to execute the command from the custom netns:
ip netns exec myns ip link set eth10 netns 1