9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <forsyth@terzarima.net>
To: nikils@gmail.com, 9fans@cse.psu.edu
Subject: Re: [9fans] ip masquerading
Date: Wed,  8 Sep 2004 10:34:02 +0100	[thread overview]
Message-ID: <a548fb9e5a82ac1204a9723422623128@terzarima.net> (raw)
In-Reply-To: <de019991040908021047cecf42@mail.gmail.com>

if a plan 9 machine has a network interface, other plan 9
machines can import that interface to use it as a gateway; to outsiders,
calls made from inside machine(s) appear to come from the gateway
(because they do, really).   just import /net (and see below re /net.alt).

the cost is extra traffic on the inside network for 9p requests,
exportfs processes on the gateway, and some added latency.
an advantage is that since the calls do originate
on the gateway, none of the usual mess for address and port mapping is
needed.  programs on the inside in a name space where /net
has been imported make connections by reading and writing
the files in /net, but that's controlled by the gateway, so address
and port assignment are consistent across all clients and for all protocols,
without fuss.

furthermore, if the gateway has two interfaces, one can be connected to one
IP stack on the inside (say #I0), and another to a distinct IP stack
on the outside (say #I1), where the two stacks are completely separate,
and the outside stack can have different listeners (offer different services)
compared to the inside stack.  that gives you the effect of a firewall.
one difference from the usual firewall is that because there is
no path between the two stacks except by intervention of a
program or manipulation of the name space, it's easier to
ensure that nothing will leak.  in other words, it isn't relying
on filtering rules within a single stack in the kernel, but on
having complete isolation between the two networks,
as far as the kernel and IP stacks are concerned.

because of a hack in dial(), if insiders bind the outside stack to
/net.alt, dial will try that if a call through /net can't be made (eg,
because it hasn't got the names or addresses needed).

to do nat/natp, some programming is required.  (others have done this
but the code isn't available.)  one approach is to have two
stacks as above, and have a single application bind a netdev (see ip(3))
onto each, one with an inside address and the other with the external
address known to outsiders.  it can then copy packets between them with
any filtering or transformation as required (ipmux might be helpful).
it again adds a bit of latency, but no network traffic (and it will work
for non plan 9 clients).  the ftp/dns/http protocol-specific
code is in user mode.

it is possible to mix these approaches.



  parent reply	other threads:[~2004-09-08  9:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-08  6:44 Nikhil S
2004-09-08  8:49 ` geoff
     [not found] ` <497b48e52d028c9cd68b5283a6a78927@collyer.net>
2004-09-08  9:10   ` Nikhil S
2004-09-08  9:14     ` geoff
2004-09-08  9:34     ` Charles Forsyth [this message]
     [not found]     ` <10978f9511a2be00107237fc8117c104@terzarima.net>
2004-09-08 10:08       ` Nikhil S
2004-09-08 10:23         ` Charles Forsyth
2004-09-08 12:59         ` Russ Cox
2004-09-08  9:17 bmaroshe

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=a548fb9e5a82ac1204a9723422623128@terzarima.net \
    --to=forsyth@terzarima.net \
    --cc=9fans@cse.psu.edu \
    --cc=nikils@gmail.com \
    /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).