* Port forwarding inside local domain
@ 2007-08-20 14:11 Bertram Scharpf
2007-08-20 14:34 ` Ruben Laban
0 siblings, 1 reply; 4+ messages in thread
From: Bertram Scharpf @ 2007-08-20 14:11 UTC (permalink / raw)
To: netfilter
Hi,
just another question. Let my router be 192.168.7.33 with
interfaces eth0 and ppp0; then this works perfectly here:
# iptables -t nat -A PREROUTING -i ppp+ -p tcp --dport 80 \
-j DNAT --to 192.168.7.49:80
However, I want to request from inside my local domain the
same way. This seems to end in a drop or an infinite loop:
# iptables -t nat -A PREROUTING -d 192.168.7.33 -p tcp --dport 80 \
-j DNAT --to 192.168.7.49:80
Besides that I want to know what is going wrong here, I
further would like to ask how I could debug this.
Thanks in advance.
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Port forwarding inside local domain
2007-08-20 14:11 Port forwarding inside local domain Bertram Scharpf
@ 2007-08-20 14:34 ` Ruben Laban
2007-08-20 19:10 ` Bertram Scharpf
0 siblings, 1 reply; 4+ messages in thread
From: Ruben Laban @ 2007-08-20 14:34 UTC (permalink / raw)
To: netfilter
On Monday 20 August 2007, Bertram Scharpf wrote:
> Hi,
>
> just another question. Let my router be 192.168.7.33 with
> interfaces eth0 and ppp0; then this works perfectly here:
>
> # iptables -t nat -A PREROUTING -i ppp+ -p tcp --dport 80 \
> -j DNAT --to 192.168.7.49:80
>
> However, I want to request from inside my local domain the
> same way. This seems to end in a drop or an infinite loop:
>
> # iptables -t nat -A PREROUTING -d 192.168.7.33 -p tcp --dport 80 \
> -j DNAT --to 192.168.7.49:80
>
> Besides that I want to know what is going wrong here,
You need to 'fix' the reply traffic, by using a rule like:
# iptables -t nat -A POSTROUTING -i eth0 -d 192.168.7.49 -p tcp --dport 80 \
-j SNAT --to 192.168.7.33
With recent kernels this can be done more elegantly by using the conntrack
module:
# iptables -t nat -A POSTROUTING -d 192.168.7.49 -m conntrack --ctorigdst \
192.168.7.49 -j SNAT --to 192.168.7.33
I never used the latter myself due to me working with older kernels mainly.
> I further would like to ask how I could debug this.
tcpdump and/or wireshark is/are your best friend(s).
HTH,
--
Ruben
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Port forwarding inside local domain
2007-08-20 14:34 ` Ruben Laban
@ 2007-08-20 19:10 ` Bertram Scharpf
2007-08-21 6:57 ` Ruben Laban
0 siblings, 1 reply; 4+ messages in thread
From: Bertram Scharpf @ 2007-08-20 19:10 UTC (permalink / raw)
To: Ruben Laban, netfilter
Hi,
Am Montag, 20. Aug 2007, 16:34:31 +0200 schrieb Ruben Laban:
> On Monday 20 August 2007, Bertram Scharpf wrote:
> >
> > # iptables -t nat -A PREROUTING -d 192.168.7.33 -p tcp --dport 80 \
> > -j DNAT --to 192.168.7.49:80
> >
> > Besides that I want to know what is going wrong here,
>
> You need to 'fix' the reply traffic, by using a rule like:
> # iptables -t nat -A POSTROUTING -i eth0 -d 192.168.7.49 -p tcp --dport 80 \
> -j SNAT --to 192.168.7.33
iptables v1.3.5: Can't use -i with POSTROUTING
> With recent kernels this can be done more elegantly by using the conntrack
> module:
> # iptables -t nat -A POSTROUTING -d 192.168.7.49 -m conntrack --ctorigdst \
> 192.168.7.49 -j SNAT --to 192.168.7.33
Seems it's "... --ctorigdst 192.168.7.33 -j ...".
Works fine. Thanks!
Bertram
--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Port forwarding inside local domain
2007-08-20 19:10 ` Bertram Scharpf
@ 2007-08-21 6:57 ` Ruben Laban
0 siblings, 0 replies; 4+ messages in thread
From: Ruben Laban @ 2007-08-21 6:57 UTC (permalink / raw)
To: netfilter
On Monday 20 August 2007, Bertram Scharpf wrote:
> Am Montag, 20. Aug 2007, 16:34:31 +0200 schrieb Ruben Laban:
> > You need to 'fix' the reply traffic, by using a rule like:
> > # iptables -t nat -A POSTROUTING -i eth0 -d 192.168.7.49 -p tcp --dport
> > 80 \ -j SNAT --to 192.168.7.33
>
> iptables v1.3.5: Can't use -i with POSTROUTING
>
> > With recent kernels this can be done more elegantly by using the
> > conntrack module:
> > # iptables -t nat -A POSTROUTING -d 192.168.7.49 -m conntrack
> > --ctorigdst \ 192.168.7.49 -j SNAT --to 192.168.7.33
>
> Seems it's "... --ctorigdst 192.168.7.33 -j ...".
Two 'stupid' mistakes indeed. Guess I should've reviewed my own posts a little
more.
> Works fine. Thanks!
Glad it worked out for you afterall.
Regards,
--
Ruben
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-21 6:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-20 14:11 Port forwarding inside local domain Bertram Scharpf
2007-08-20 14:34 ` Ruben Laban
2007-08-20 19:10 ` Bertram Scharpf
2007-08-21 6:57 ` Ruben Laban
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox