netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Harald Welte <laforge@gnumonks.org>, netdev@vger.kernel.org
Subject: Re: loosing netdevices with namespaces and unshare?
Date: Tue, 30 May 2017 17:41:26 -0600	[thread overview]
Message-ID: <d267709c-fd8f-bc0e-0295-29ab6422cb08@gmail.com> (raw)
In-Reply-To: <20170530220741.ldmhwj3bsvdoaofc@nataraja>

On 5/30/17 4:07 PM, Harald Welte wrote:
> In case you're wondering what I'm actually trying to achieve: Find
> an easy way to run a single program in an isolated namespace that only
> has one physical (usb) ethernet device.  I would like to execute that
> program as unprivileged user but still be able to bind to privileged
> ports.  And I want to do this using simple command-line tools without
> all the bloat and overhead of "container" solutions that have 99% of
> features I don't need.  But let that not distract you, I think the
> mysteriously disappearing netdevices are a more general and important
> issue.

An alternative approach is to create a bridge and add the usb ethernet
device to it. As you want to launch a program, create a veth pair. Put
one end into the bridge, and the other end into the new network namespace.

All of this can be scripted quite easily with 'ip' - including
configuring the veth device pushed into the namespace and running the
command. Use unshare for the other namespaces.

      parent reply	other threads:[~2017-05-30 23:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 22:07 loosing netdevices with namespaces and unshare? Harald Welte
2017-05-30 23:18 ` Cong Wang
2017-05-31 12:27   ` Harald Welte
2017-05-31 17:44     ` Cong Wang
2017-05-31 18:11       ` Harald Welte
2017-05-31 22:40         ` Cong Wang
2017-05-31 23:13           ` Harald Welte
2017-06-01  6:32       ` Eric W. Biederman
2017-06-01  7:00         ` Harald Welte
2017-06-01  7:48           ` Eric W. Biederman
2017-06-02 23:25         ` Cong Wang
2017-06-03 10:53           ` Eric W. Biederman
2017-05-30 23:41 ` David Ahern [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d267709c-fd8f-bc0e-0295-29ab6422cb08@gmail.com \
    --to=dsahern@gmail.com \
    --cc=laforge@gnumonks.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).