All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ray Leach <raymondl@knowledgefactory.co.za>
To: Mark Ayad <mark@javamark.com>
Cc: Antony Stone <Antony@Soft-Solutions.co.uk>, netfilter@lists.samba.org
Subject: Re: Destination NAT Onto the Same Network Problem
Date: 10 Jul 2002 17:14:54 +0200	[thread overview]
Message-ID: <1026314094.13422.2.camel@rayw> (raw)
In-Reply-To: <000b01c22821$3c6b1e00$0300a8c0@W2KP01>

Hi

For my internal lan trying to browse me web servers in the dmz this is
what I do:

$IPTABLES -t nat -A PREROUTING -i $IFACE_INT -p tcp --dport 80 -d
$IP_INET_WEB1 -j DNAT --to $IP_INT_WEB1

$IPTABLES=/sbin/iptables
$IFACE_INT=eth1
$IP_INET_WEB1=196.4.160.12	# internet address of web server
$IP_INT_WEB1=192.168.1.12	# internal ip of the web server

One other thing, you must put this rule before redirecting web traffic
to a transparent proxy.

Ray


On Wed, 2002-07-10 at 16:51, Mark Ayad wrote:
> Nice try but no luck
> 
> $IPTABLES -t nat -A POSTROUTING -o $INTIF -i $INTIF -j
> 
> can't use -i in POSTROUTING
> 
> So I tried
> 
> $IPTABLES -t nat -A POSTROUTING -o $INTIF 192.168.0.0/24 -j MASQUERADE
> 
> No luck there although this time the rule is correct.
> 
> So I tried
> 
> $IPTABLES -t nat -A POSTROUTING -o $INTIF 192.168.0.3 -j MASQUERADE
> 
> ...but no success.
> 
> I know this is a silly problem, since I could used the internal IP of the
> web server, but I want to crack this to be sure the server can be reached
> via the external address. At the moment I confirm this using a web
> anonymiser.
> 
> Mark
> 
> 
> 
> ----- Original Message -----
> From: "Antony Stone" <Antony@Soft-Solutions.co.uk>
> To: <netfilter@lists.samba.org>
> Sent: Wednesday, July 10, 2002 4:22 PM
> Subject: Re: Destination NAT Onto the Same Network Problem
> 
> 
> > On Wednesday 10 July 2002 2:54 pm, Mark Ayad wrote:
> >
> > > I have a problem with the following Firewall Script which works fine
> apart
> > > from when I try to INTERNALLY connect to the webserver 192.168.0.3:80
> > > using the public IP which if I'm right should be the same as $EXTIF. The
> > > internal machine I'm launching the request from is actually the
> webserver
> > > (but that shouldn't matter).
> > >
> > > I know I'm missing a line from what I read in
> > >
> http://netfilter.samba.org/unreliable-guides/NAT-HOWTO/NAT-HOWTO.linuxdoc-1
> > >0 .html and I've tried nearly every combination I can think of except the
> > > one that works that is.
> > >
> > > So whats the missing line ?
> > >
> > > $IPTABLES -A INPUT -p tcp --syn --destination-port 80 -j ACCEPT
> > > $IPTABLES -A INPUT -p tcp --syn -j DROP
> > >
> > > $IPTABLES -A FORWARD -i $EXTIF -o $INTIF -j ACCEPT
> > > $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
> > > $IPTABLES -A FORWARD -j LOG
> > >
> > > $IPTABLES -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j
> > > DNAT --to-destination 192.168.0.3:80
> > >
> > > $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
> >
> > This one looks a bit odd to me, even though I've written it myself, but I
> > think it should do the trick:
> >
> > $IPTABLES -t nat -A POSTROUTING -o $INTIF -i $INTIF -j MASQUERADE
> >
> > If it doesn't, then just use the standard version:
> >
> > $IPTABLES -t nat -A POSTROUTING -o $INTIF -s a.b.c.d/n -j MASQUERADE
> >
> > where a.b.c.d/n is your internal network range.
> >
> >
> >
> > Antony.
> >
> >
> 
> 




  parent reply	other threads:[~2002-07-10 15:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-10 13:54 Destination NAT Onto the Same Network Problem Mark Ayad
2002-07-10 14:22 ` Antony Stone
2002-07-10 14:38   ` Tom Eastep
2002-07-10 14:57     ` Antony Stone
2002-07-10 15:10       ` Joe Patterson
2002-07-10 15:46         ` Antony Stone
2002-07-10 16:42           ` Big Man
2002-07-10 15:29       ` Mark Ayad
2002-07-10 15:42         ` Antony Stone
2002-07-10 14:51   ` Mark Ayad
2002-07-10 15:01     ` Antony Stone
2002-07-10 15:14     ` Ray Leach [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-07-10 15:47 Mark Ayad

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=1026314094.13422.2.camel@rayw \
    --to=raymondl@knowledgefactory.co.za \
    --cc=Antony@Soft-Solutions.co.uk \
    --cc=mark@javamark.com \
    --cc=netfilter@lists.samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.