Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Chris Wilson <chris@netservers.co.uk>
To: Carlo Florendo <carlo@astra.ph>
Cc: netfilter@lists.netfilter.org
Subject: Re: DNAT from an IP address that does not exist to another that exists
Date: Fri, 1 Aug 2003 16:13:04 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0308011600260.31382-100000@localhost> (raw)
In-Reply-To: <018f01c35647$f68f9ea0$200aa8c0@thorin>

Hi Carlo,

> The gateway address is 192.168.30.1
> The non-existent address which I want to DNAT to another machine 
> within the network is 192.168.40.40
> The existent IP address where I want 192.168.40.40 to be forwarded to, 
> is 192.168.30.11

This is a case of what I call "bermuda triangle" routing, and is
definitely a FAQ. The problem is that the replies to your connection go
_directly_ back from 192.168.30.11 to 192.168.30.x, without going through
the firewall, and as a result they don't get un-masqueraded, and
192.168.30.x ignores them, since it's expecting to see packets from
192.168.40.40 instead of 192.168.30.11.

The only solution that I know is to masquerade the DNAT'ed packets, so 
that they will always go back through the firewall. For example, in your 
case:

  iptables -t nat -I POSTROUTING -s 192.168.30.0/24 -d 192.168.30.11 \
	-j MASQUERADE

Cheers, Chris.
-- 
   ___ __     _
 / __// / ,__(_)_  | Chris Wilson -- UNIX Firewall Lead Developer |
/ (_ / ,\/ _/ /_ \ | NetServers.co.uk http://www.netservers.co.uk |
\ _//_/_/_//_/___/ | 21 Signet Court, Cambridge, UK. 01223 576516 |




  reply	other threads:[~2003-08-01 15:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-30  3:09 DNAT from an IP address that does not exist to another that exists Carlo Florendo
2003-08-01 15:13 ` Chris Wilson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-30  3:13 Carlo Florendo
2003-07-30  3:40 George Vieira
2003-07-30  3:48 George Vieira
2003-07-30  4:06 ` Carlo Florendo
     [not found] <004e01c35caf$86bd4910$200aa8c0@thorin>
2003-08-07  6:55 ` Carlo Florendo
2003-08-07 12:03   ` Whit Blauvelt

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=Pine.LNX.4.44.0308011600260.31382-100000@localhost \
    --to=chris@netservers.co.uk \
    --cc=carlo@astra.ph \
    --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