Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Bo Jacobsen" <subs@systemhouse.dk>
To: netfilter@lists.netfilter.org
Subject: Re: Redirection to local lan, isn't DNAT method unsafe.
Date: Thu, 1 Apr 2004 10:55:50 +0200	[thread overview]
Message-ID: <004301c417c7$232981b0$de0aa8c0@comp> (raw)
In-Reply-To: 200404010937.47442.Antony@Soft-Solutions.co.uk

> > I use DNAT to redirect traffic from the external lan eth0 (192.168.1.1) to
> > a specific host (192.168.10.10) on the internal lan (eth1) like this:
> >
> > iptables -t nat -A PREROUTING  -p tcp --dport 80  -d 192.168.1.1 -j DNAT
> >     --to 192.168.10.10 -i eth0
> >
> > and then I allow the redirected traffic:
> > iptables -a FORWARD -p tcp --dport 80  -d 192.168.10.10 ........
> >
> > It works as expected but with this aproach, it's actually possible from the
> > outside to find out what internal ip, the http server is located at !.
> > All one has to do is sending to 192.168.10.1, 192.168.10.2, 192.168.10.3
> > etc.  (to eth0 on the outside) until one hits the server. The rules allows
> > it.
> >
> > I have not been able to figure out how to solve this problem.
> 
> It is normally recommended *not* to do filtering in the nat or mangle tables, 
> however in this case if you really want to do what you say then that is the 
> solution.
> 
> iptables -I PREROUTING -t nat -s 192.168.1.0/24 -d 192.168.10.10 -p tcp 
> --dport 80 -j DROP
> 
> Note the -I which inserts the rule before the prerouting rule you listed 
> above.
> 
> Regards,
> 
> Antony.

Thanks.

> however in this case if you really want to do what you say then that is the 
> solution.

Is there another and better way to redirect traffic to the inside ?

Bo




  reply	other threads:[~2004-04-01  8:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-30 12:46 Redirecting ports on localhost Fabiano Bonin
2004-03-30 13:00 ` David Cannings
2004-04-01  8:25 ` Redirection to local lan, isn't DNAT method unsafe Bo Jacobsen
2004-04-01  8:37   ` Antony Stone
2004-04-01  8:55     ` Bo Jacobsen [this message]
2004-04-01  9:05       ` Antony Stone
2004-04-01  9:42         ` Bo Jacobsen
2004-04-01  9:55           ` Antony Stone
2004-04-01 12:43             ` Bo Jacobsen
2004-04-01 22:20             ` Unknown, Alistair Tonner
     [not found]             ` <200404011720.57604.Alistair Tonner <>
2004-04-01 22:52               ` Antony Stone
2004-04-22  3:49   ` Alexander Samad

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='004301c417c7$232981b0$de0aa8c0@comp' \
    --to=subs@systemhouse.dk \
    --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