Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mark Ord <lists@losthorizons.mailshell.com>
To: netfilter@lists.netfilter.org
Subject: Re: Forwarding non local packets to loopback with iptables?
Date: Tue, 14 Sep 2004 09:31:49 +1000	[thread overview]
Message-ID: <20040913233149.GA2378@scholars.home> (raw)
In-Reply-To: <1094603729.1751.34.camel@wolfpack.ljm.dom>

On Wed, Sep 08, 2004 at 08:34:07AM +0000, opie at 817west. com Wed Sep 8 02 wrote:

> On Tue, 2004-09-07 at 07:49, Mark Ord wrote:
> > 
> > What I want to do is set up a SSH tunnel to another machine, behind
> > another firewall, and use the eth1 aliases to access the remote machines from my
> > local network (eth1) and the iptables machine. I tried to set this up
> > before with iptables, failed, 
> 
> can we revisit why that failed, perhaps?

Basically being new to iptables at the time. I set up NAT, firewall and
the internet -> internal forwardings I wanted, had a crack at setting up
what I described in the original email, couldn't get it to work, discovered
rinetd, and went with that.

Now, months later, that I know a lot more about using iptables, I decided to
try again.

> > Last time I tried to establish this with iptables, I got nowhere. This time
> > around I got it working on the iptables machine with:
> > 
> > $IPTABLES -t nat -I OUTPUT -p tcp -s 192.168.0.128 --dport 3389 \
> >         -j DNAT --to 127.0.0.1:13389
> >    .. etc .. for each address and port required.
> > 
> > Connecting to 129.168.0.128 port 3389 takes me where I want - down the
> > ssh tunnel, to machine on the remote network.
> 
> this isn't exactly a great test scenario, as you're testing locally on
> the box itself, which will not cleanly extrapolate to the forwarding
> scenario.

Well, I want to be able to connect to 192.168.0.128 from the firewall box
itself (working) in addition to being able to from the rest of the
192.168.0.0/24 network (not working).

> > Is it possible to achieve this with iptables (redirecting traffic coming in
> > on eth1 (for eth1:?) to a port on 127.0.0.1), and if so, what rules are
> > required?
> 
> no.

Thanks.

> but since you have dedicated IP addresses per host--why aren't you
> just DNAT-ing from the IP on eth1 directly to the host that should
> receive the traffic (i believe this is the "previously failed"
> scenario)?

Because what is bound to 192.168.0.128 (in reality to the loopback, which
192.168.0.128 is supposed to forward to) are via ssh port forwards to a
machine behind another firewall, with non-routable addresses. The idea is to
connect to 192.168.0.128, but actually end up connected to a machine that is
out on the internet, not something physically on the LAN.

Thanks for the response,
Mark.



      reply	other threads:[~2004-09-13 23:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-07 11:49 Forwarding non local packets to loopback with iptables? Mark Ord
2004-09-08  0:35 ` Jason Opperisano
2004-09-13 23:31   ` Mark Ord [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=20040913233149.GA2378@scholars.home \
    --to=lists@losthorizons.mailshell.com \
    --cc=netfilter@lists.netfilter.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