From: Joel Newkirk <netfilter@newkirk.us>
To: "Herbert G. Fischer" <manager@trama.com>
Cc: NetFilter Users <netfilter@lists.netfilter.org>
Subject: Re: External Resolved IPs
Date: 16 Jun 2003 18:33:33 -0400 [thread overview]
Message-ID: <1055802812.19430.188.camel@alpha.newkirk.us> (raw)
In-Reply-To: <003001c3344a$5d220240$093010ac@power>
On Mon, 2003-06-16 at 17:00, Herbert G. Fischer wrote:
> My problem is that, when I try to connect to a internal server, using the
> external and real
> IP, I cannot because my FW/NAT appears to be confused or misconfigured.
>
> For example:
>
> Internal Network: 172.16.48.0/24
>
> My IP: 172.16.48.10
> Server Internal IP: 172.16.48.20
> * Both are on the same network
>
> Server External IP: 200.180.180.20 (IP alias on FW/NAT machine, that
> redirects to 172.16.48.20)
> DNS name of Server: server.domain.com, points to 200.180.180.20
> # server
> iptables -t nat -A POSTROUTING -s 172.16.48.20 -j SNAT --to-source
> 200.180.180.20
> iptables -t nat -A PREROUTING -s 0/0 -d 200.180.180.20 -j
> DNAT --to-destination 172.16.48.20
>
> # NAT for the rest of the world
> iptables -t nat -A POSTROUTING -o eth1 -s 172.16.48.0/24 -j SNAT --to-source
> 200.180.180.22
When a request from a local client arrives at the iptables box addressed
to 200.180.180.20, it hits PREROUTING and is DNATted to the appropriate
server. Problem is that the server tries to reply directly to the
client, (since it's a local IP) which sees a 'new' connection from
172.16.48.20, which it ignores. Try adding:
iptables -t nat -A POSTROUTING -d 172.16.48.20 -s 172.16.48.0/24 -j SNAT
--to iptables.box.local.ip
With this additional rule in place, requests from local clients hit the
iptables box and are DNATted to the local server, then before leaving
the iptables box they are SNATted so that the server sends its reply
back to the iptables box. When that reply is received by the iptables
box, it unSNATs and restores the correct destination IP (the local
client) then before it leaves the box it unDNATs to restore the correct
source IP (the local server's public IP).
j
next prev parent reply other threads:[~2003-06-16 22:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-16 21:00 External Resolved IPs Herbert G. Fischer
2003-06-16 22:33 ` Joel Newkirk [this message]
2003-06-17 15:46 ` Herbert G. Fischer
-- strict thread matches above, loose matches on Subject: below --
2003-06-17 3:59 Deshwal Chand
2003-06-17 4:40 Deshwal Chand
2003-06-17 5:33 Deshwal Chand
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=1055802812.19430.188.camel@alpha.newkirk.us \
--to=netfilter@newkirk.us \
--cc=manager@trama.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