* [gentoo-user] Managing network interface in a namespace
@ 2016-11-18 19:41 Róbert Čerňanský
0 siblings, 0 replies; only message in thread
From: Róbert Čerňanský @ 2016-11-18 19:41 UTC (permalink / raw
To: gentoo-user
Hi all,
I would like to bring up and configure a network interface which
exists in a (network) namespace. I would like to use standard OpenRC
'net.<iface>' init script to do so.
Since the interface (veth1) exists only in a namespace (myns) I need
that the init script would be executed within that namespace:
ip netns exec myns /etc/init.d/net.veth1 start|stop|...
While I can do that manually as above the automatic run (during boot)
is however executed in the global namespace.
My current, not very good approach is that I've created a wrapper around
runscript and created a copy of /etc/init.d/net.lo
to /etc/init.d/net.veth1 where I've changed the first line to that
wrapper. It does work when invoking the script manually but it is not
executed by OpenRC at all during boot or when I type 'rc' even if
net.veth1 is included in default runlevel. Also, to have a copy of init
script is not very nice. Therefore I'm seeking other solutions. Is
there any way to tell OpenRC that it should configure an interface
in a specific namespace?
The wrapper script for curious:
#!/bin/sh
namespace=${1}
shift
/bin/ip netns exec ${namespace} /sbin/runscript ${@}
First line of /etc/init.d/net.veth1 then looks like this:
#!/usr/local/bin/runscript-netns myns
Robert
--
Róbert Čerňanský
E-mail: openhs@tightmail.com
Jabber: hs@jabber.sk
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-18 19:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-18 19:41 [gentoo-user] Managing network interface in a namespace Róbert Čerňanský
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox