From: Pascal Hambourg <pascal@plouf.fr.eu.org>
To: Peter Chen <peter.feifan.chen@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: transparent proxy with iptable redirect
Date: Tue, 17 Mar 2015 10:07:43 +0100 [thread overview]
Message-ID: <5507EEDF.8040808@plouf.fr.eu.org> (raw)
In-Reply-To: <CAMGYKAewXqwykFeHWSxLeW-MJP9xqujuRMT6pwOEsjUDtGQFtA@mail.gmail.com>
Peter Chen a écrit :
> I have a pretty straightforward question that I've been wondering. If
> I add an iptable redirect rule (e.g. dst tcp port 80 to tcp port
> 8080), it would change every tcp packet with port 80 as its
> destination to a tcp packet with destination 8080. Now if my
> application listening on 8080 were to reply to the source, it would
> transmit a tcp packet with src port 8080, but the source side is
> expecting a tcp packet with src port 80.
>
> So my question is, how does the reverse path from dest back to the
> src, at what point does the port number get rewritten from 8080 back
> to 80, making the redirect transparent? Is this done by iptable
> automatically on a redirect target?
Yes. Stateful NAT takes care of both directions of the connection.
prev parent reply other threads:[~2015-03-17 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-17 6:37 transparent proxy with iptable redirect Peter Chen
2015-03-17 9:07 ` Pascal Hambourg [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=5507EEDF.8040808@plouf.fr.eu.org \
--to=pascal@plouf.fr.eu.org \
--cc=netfilter@vger.kernel.org \
--cc=peter.feifan.chen@gmail.com \
/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