[quagga-users 14019] Re: Running Multiple Instances of Quagga

Jafar Al-Gharaibeh jafar at atcorp.com
Wed Jun 17 19:29:35 BST 2015


On 6/17/2015 1:23 PM, Nicolas Dichtel wrote:
> Le 17/06/2015 18:40, Jafar Al-Gharaibeh a écrit :
>> On 6/17/2015 10:03 AM, Nicolas Dichtel wrote:
>>> Le 17/06/2015 16:41, Jafar Al-Gharaibeh a écrit :
>>>>
>>>> On 6/17/2015 8:40 AM, Nicolas Dichtel wrote:
>>>>> Le 16/06/2015 16:28, Olivier Tilmans a écrit :
>>>>>> Hello Jafar,
>>>>>>
>>>>>> If you don't have a 'main' process in the network namespace in 
>>>>>> charge of
>>>>>> spawning all other processes for that namespace to which you can 
>>>>>> send
>>>>>> command, then you will need to remount /var/run each time you 
>>>>>> issue an
>>>>>> ip netns exec as mount namespaces are process-inherited.
>>>>>>
>>>>>> e.g.
>>>>>> mkdir -p /tmp/newns/var/run
>>>>>> ip netns add newns
>>>>>> ip netns exec newns bash -c 'mount --bind /tmp/newns/var/run 
>>>>>> /var/run &&
>>>>>> command_to_start_quagga'
>>>>>> ## Later on ...
>>>>>> ip netns exec newns bash -c 'mount --bind /tmp/newns/var/run 
>>>>>> /var/run &&
>>>>>> vtysh'
>>>>>>
>>>>>> A less constraining solution would be to patch the daemons & 
>>>>>> vtysh to
>>>>>> add a launch argument to specify to location of the vtysh socket ...
>>>>> It is also possible to set the default path to
>>>>> /etc/netns/<iproute2-netns-name>/var/run/ instead of /var/run/.
>>>>> 'ip netns exec foo command_to_start_quagga' will remount 
>>>>> /etc/netns/foo to
>>>>> /etc/
>>>>>
>>>>> It's a bit ugly, but it's simpler ;-)
>>>>
>>>> Nicolas,
>>>>
>>>>     How do you set a default path that is only specific to a 
>>>> network namespace?
>>> Maybe I've misread your problem, but the default path will be: 
>>> /etc/var/run/.
>>> And this path is the same for all daemons.
>>>
>>> 'ip netns exec foo' will override /etc/var/run with 
>>> /etc/netns/foo/var/run,
>>> thus all daemons see only /etc/var/run, but it's a different mount 
>>> point in
>>> every netns.
>>
>>    I got that. My question was how to create a private mount point 
>> for a network
>> namespace.
>>
>>    Olivier suggested this originally - needed a mount with every 
>> command:
>>
>>     1- ip netns add newns
>>     2- ip netns exec newns bash -c 'mount --bind /tmp/newns/var/run 
>> /var/run &&
>> command_to_start_quagga'
>>
>>    You suggested this:
>>
>>     1- ip netns add newns
>>     2- Do something here that changes the mount point "permanently" 
>> for newns,
>> something like:
>>             ip netns exec newns mount -b /etc/netns/newns/var/run/ 
>> /var/run/
> No. I just said that this trick is done automatically by 'ip netns 
> exec', thus
> you don't need to do it manually.
> See iproute2 code:
> https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/ipnetns.c#n396: 
> netns_exec()
> => 
> https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/ip/ipnetns.c#n415: 
> netns_switch()
> => 
> https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/lib/namespace.c#n84: 
> bind_etc()
> => 
> https://git.kernel.org/cgit/linux/kernel/git/shemminger/iproute2.git/tree/lib/namespace.c#n16
>
I've just finished reading about the command "ip netns exec" and 
realized that.  The only missing piece in my configuration is to 
actually create those private paths under /etc/netns/  so that they 
override the standard paths. That is what I didn't get the first time!

Thank you very much!
Jafar





More information about the Quagga-users mailing list