Networking Forums

Networking Forums > Computer Networking > Linux Networking > iptables DNAT problem from internal net

Reply
Thread Tools Display Modes

iptables DNAT problem from internal net

 
 
Lothar Behrens
Guest
Posts: n/a

 
      09-10-2003, 09:24 AM
Hello,

I have configured my firewall to DNAT the following adresses to
be forwarded to internal server.

217.5.155.20, 217.5.155.22

On 217.5.155.22 you will see an apache server running on Windows
On 217.5.155.20 you will see an apache server running on Linux 7.3

If I try to connect to them from internal, I can't see these pages.

Any help ?

Thanks

Lothar
 
Reply With Quote
 
 
 
 
Cedric Blancher
Guest
Posts: n/a

 
      09-10-2003, 09:44 AM
Dans sa prose, Lothar Behrens nous ecrivait :
> I have configured my firewall to DNAT the following adresses to be
> forwarded to internal server.
> 217.5.155.20, 217.5.155.22
> On 217.5.155.22 you will see an apache server running on Windows On
> 217.5.155.20 you will see an apache server running on Linux 7.3
> If I try to connect to them from internal, I can't see these pages.


It's a very common issue.

When you try to connect to your DNATed addresses from the LAN, this is
what happens. Suppose A is LAN host, S DNATed server and G the gateway.

A sends SYN to 217.5.155.20 via G (defautl gateway)
G DNATs 217.5.155.20 to IP(S) and routes SYN to S
S recieve a SYN from A and replies SYN-ACK

For A is in the same subnet than S, S sends SYN-ACK directly to A, not
using G as gateway. Thus, SYN-ACK can't be deDNATed.

A recieve a SYN-ACK from S

For A waits for a SYN-ACK from 217.5.155.20, it drops S SYN-ACK and you
can't connect.

To make to whole thing work, you have to force S to reply through G for
S packets to A get deDNATed. The simpliest way to achieve this a to set a
SNAT rule on G, for LAN sourced connections to S :

iptables -t nat -A POSTROUTING -s <LAN> -d <IP(S)> -j SNAT \
--to <IP(G) on LAN>

Do it for both 217.5.155.20 and 217.5.155.22 DNAT targets and you're done.

--
Usenet: lisez bourré, postez déchirés.
-+- LC in <http://neuneu.mine.nu> : Le postage sans peine. -+-

 
Reply With Quote
 
Rudolf Potucek
Guest
Posts: n/a

 
      09-16-2003, 07:49 AM
I am still fighting with this in some ways, but a cleaner and simpler
solution (if you are on a private IP subnet) is to just put the http
server on its own subnet. The IPs you use seem to be "real" but in that
case the problem would be better solved with iproute2 anyhow ...

Rudolf

[Snip]pets of what Cedric Blancher <(E-Mail Removed)> wrote:
: Dans sa prose, Lothar Behrens nous ecrivait :
:> I have configured my firewall to DNAT the following adresses to be
:> forwarded to internal server.
:> 217.5.155.20, 217.5.155.22
:> On 217.5.155.22 you will see an apache server running on Windows On
:> 217.5.155.20 you will see an apache server running on Linux 7.3
:> If I try to connect to them from internal, I can't see these pages.

: It's a very common issue.

--
It would be really bad for my selfesteem to marry someone I don't love.
It would make me feel like I am selling myself.
-- Marije
Interesting. In the American system it would be good for your selfesteem:
"look I am important enough that this *rich* guy will marry me!"
--Rudolf
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables, DNAT, and SMTP Brandon Linux Networking 6 03-11-2007 05:55 PM
Iptables {DNAT,REDIRECT} Akede Linux Networking 1 10-07-2004 03:06 AM
Iptables, DNAT, Forwarding? problem... Mitch Linux Networking 1 04-19-2004 04:23 PM
iptables DNAT question Claudio Nieder Linux Networking 2 11-21-2003 07:51 PM
Iptables, Cisco 677, DNAT Eugene van Rooyen Linux Networking 0 08-10-2003 10:57 AM



1 2 3 4 5 6 7 8 9 10 11