How can I move an interface out of a network namespace?

deitch asked:

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 answered:

I would specify the network namespace by process ID.

ip link set eth10 netns 1

By setting it to the same network namespace as pid 1 (init/systemd) it should return to where you expect it.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.