Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Jörg Harmuth" <harmuth@mnemon.de>
To: netfilter@lists.netfilter.org
Subject: Re: iptables local port forward
Date: Mon, 10 Oct 2005 16:41:46 +0200	[thread overview]
Message-ID: <434A7DAA.6030306@mnemon.de> (raw)
In-Reply-To: <freemail.20050910153926.43612@fm17.freemail.hu>

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


      reply	other threads:[~2005-10-10 14:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-10 13:39 iptables local port forward dfgdfg dfgdf
2005-10-10 14:41 ` Jörg Harmuth [this message]

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=434A7DAA.6030306@mnemon.de \
    --to=harmuth@mnemon.de \
    --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