* iptables local port forward
@ 2005-10-10 13:39 dfgdfg dfgdf
2005-10-10 14:41 ` Jörg Harmuth
0 siblings, 1 reply; 2+ messages in thread
From: dfgdfg dfgdf @ 2005-10-10 13:39 UTC (permalink / raw)
To: netfilter
Hi
I have a question about iptables port forward:
I have the following rules which are working ok if I try it
from outside
but when I try it from the localhost (which is running the
iptables) it is not working ?
Does any body know why it isn't working this way?
and what is the solution ?
Thx a lot
Anti
------------------
# Redirect port 5900
iptables -t nat -A PREROUTING -p tcp -d $LOCAL_IP --dport
5900 -j DNAT --to $OTHER_HOST_IP:5900
iptables -t nat -A POSTROUTING -o eth0 -p tcp -d
$OTHER_HOST_IP --dport 5900 -j MASQUERADE
____________________________________________________________________________________________
Kisbabád lesz? Kisbabád született? Tele vagy kérdésekkel, és nem tudod, hol találsz választ?
Kukkants be a Babázóba! - www.babazo.hu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: iptables local port forward
2005-10-10 13:39 iptables local port forward dfgdfg dfgdf
@ 2005-10-10 14:41 ` Jörg Harmuth
0 siblings, 0 replies; 2+ messages in thread
From: Jörg Harmuth @ 2005-10-10 14:41 UTC (permalink / raw)
To: netfilter
dfgdfg dfgdf wrote:
> Hi
>
> I have a question about iptables port forward:
> I have the following rules which are working ok if I try it
> from outside
> but when I try it from the localhost (which is running the
> iptables) it is not working ?
> Does any body know why it isn't working this way?
> and what is the solution ?
>
> Thx a lot
> Anti
> ------------------
> # Redirect port 5900
> iptables -t nat -A PREROUTING -p tcp -d $LOCAL_IP --dport
> 5900 -j DNAT --to $OTHER_HOST_IP:5900
>
> iptables -t nat -A POSTROUTING -o eth0 -p tcp -d
> $OTHER_HOST_IP --dport 5900 -j MASQUERADE
What *exactly* isn't working ? Do you mean, that eg
telnet $IP_OR_NAME_OF_IPTABLES_BOX 5900
doesn't connect you with $OTHER_HOST_IP:5900, if you issue this command
on the iptables box itself ? If this is your question, well - iptables
can't do this with your rule set (assuming that the rules you posted are
only relevant rules). Locally generated packets never pass
nat/PREROUTING. They pass nat/OUTPUT instead. See
http://iptables-tutorial.frozentux.net/chunkyhtml/c951.html
for details.
Joerg
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-10-10 14:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-10 13:39 iptables local port forward dfgdfg dfgdf
2005-10-10 14:41 ` Jörg Harmuth
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.