Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Fu-Tung Cheng <futung.cheng@yahoo.com>
To: netfilter@vger.kernel.org
Cc: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
Subject: Re: 2 ips, same port, forward to original ip but different port
Date: Wed, 5 Nov 2008 10:32:28 -0800 (PST)	[thread overview]
Message-ID: <682334.72000.qm@web45902.mail.sp1.yahoo.com> (raw)
In-Reply-To: <49116A6F.1070508@plouf.fr.eu.org>

Thank you!!

You understood correctly.  I wanted any incoming on 80 to be forwarded on the same interface to 12080.

> If I understand correctly, you want to change only the
> destination port, not the destination address. But the
> iptables manpage says that the REDIRECT target replaces the
> destination address with the primary address of the incoming
> interface, so it may not be suitable for your purpose.
> 
> You can use the DNAT target instead. Either :
> 
> iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT
> --to :12080
> 
> will translate the destination port 80 into 12080
> regardless of the destination address and without changing
> it,
> 


Not sure what I thought that was supposed to do.  I just copied a couple rules for forwarding from some tutorial and those were included and didn't think to really question them.  I need to spend some more time with the man pages.  I think my big problem was that I thought iptables -F would flush all chains but instead it was likely only flushing the default chain and not the nat chain.

> PS: What is the purpose of the first rule in the FORWARD
> chain ?


Thanks again,

Fu-Tung



      


      reply	other threads:[~2008-11-05 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-05  1:38 2 ips, same port, forward to original ip but different port Fu-Tung Cheng
2008-11-05  9:42 ` Pascal Hambourg
2008-11-05 18:32   ` Fu-Tung Cheng [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=682334.72000.qm@web45902.mail.sp1.yahoo.com \
    --to=futung.cheng@yahoo.com \
    --cc=netfilter@vger.kernel.org \
    --cc=pascal.mail@plouf.fr.eu.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