All of lore.kernel.org
 help / color / mirror / Atom feed
* Destination NAT Onto the Same Network Problem
@ 2002-07-10 13:54 Mark Ayad
  2002-07-10 14:22 ` Antony Stone
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Ayad @ 2002-07-10 13:54 UTC (permalink / raw)
  To: netfilter

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-10
.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

Best Regards

Mark



^ permalink raw reply	[flat|nested] 13+ messages in thread
* RE: Destination NAT Onto the Same Network Problem
@ 2002-07-10 15:47 Mark Ayad
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Ayad @ 2002-07-10 15:47 UTC (permalink / raw)
  To: netfilter

[-- Attachment #1: Type: text/plain, Size: 1606 bytes --]

Sorry everyone, that this is getting quite long ):

I gave

$IPTABLES -t nat -A PREROUTING -d a.b.c.d -p tcp --dport 80 -j DNAT --to
192.168.0.3

a whirl but no joy, although the onnection request tqkes muck longer to time
out ?

So we have

[198.168.0.3] make a request on [198.168.0.1] the gateway  which is MASQ to
[a.b.d.c]  the ext IP of the firewall. The DNS lookup returns [a.b.d.c]
which is Postrouted DNAT mapped to [198.168.0.3]

Am I right I thinking that the source address is that of the gateway
[198.168.0.1] , which is why I get no response ?

echo "   clearing any existing rules and setting default policy.."
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F

$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 PREROUTING -d a.b.c.d -p tcp --dport 80 -j DNAT --to
192.168.0.3

$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE

echo -e "\nrc.firewall-2.4 v$FWVER done.\n"

Where where a.b.c.d is the ext IP of the firewall.

Still won't connect from an IP request on 192.168.0.3 ?

It requires a rule simply to act as a loopback but first going by the
external ip to obtain the external dns IP which is a.b.c.d.





[-- Attachment #2: Type: text/html, Size: 2143 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2002-07-10 16:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2002-07-10 15:47 Mark Ayad

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.