Subject: Re: Default network namespace name

From: Nicolas Dichtel <[email-masked]>
Date: Wed, 21 May 2014 11:44:13 +0200

Le 21/05/2014 08:36, Peter Fassberg a écrit :
>
> Hi!
>
> Is there a name of the default network namespace?
No.

>
> I would like to execute a command in the default network namespace while running
> a shell in a non-default namespace.
>
> Like this: ip netns exec "" ip link
> Or this:   ip netns exec . ip link
>
> That command end up with a mis-spelled error message: :)
> seting the network namespace "" failed: Invalid argument

You can try something like this (I suppose that init runs in your
"default network namespace") :

ip netns add foo (just to create /var/run/netns which is a tmpfs)
ip netns del foo
touch /var/run/netns/default
mount --bind /proc/1/ns/net /var/run/netns/default
ip netns exec default ip link

Regards,
Nicolas