All of lore.kernel.org
 help / color / mirror / Atom feed
From: Grant Taylor <gtaylor@riverviewtech.net>
To: netfilter@lists.netfilter.org
Subject: Re: Redirecting packet from incoming external interface to a different external machine.
Date: Wed, 17 Aug 2005 00:03:10 -0500	[thread overview]
Message-ID: <4302C50E.7020408@riverviewtech.net> (raw)
In-Reply-To: <1374867BD86E3748B9FB02AC5EDE4282C61A73@gimi-fs1.gimi.org>

iptables -t nat -A PREROUTING -i ${ExternalInterface} -d ${ExternalInterfaceIP} -p tcp --dport 21 -j DNAT --to-destination ${DestinationServerIP}:3805
iptables -t nat -A POSTROUTING -o ${ExternalInterface} -d ${DestinationServerIP} -j SNAT --to-source ${ExternalInterfaceIP}
iptables -t filter -A FORWARD -i ${ExternalInterface} -o ${ExternalInterface} -d ${DestinationServerIP} -j ACCEPT
iptables -t filter -A FORWARD -i ${ExternalInterface} -o ${ExternalInterface} -s ${DestinationServerIP} -j ACCEPT

These rules should do exactly what you are wanting.  However I'm betting that because you are talking about port 21 there is a chance that you are dealing with FTP.  If that is indeed the case you will need to be careful what you do with the other ports that FTP opens as they may not pass through the system the same way.



Grant. . . .

Jeffrey Carter wrote:
> Here is what I'm looking to do (And please tell me if I'm crazy as I've
> been beating my head on this for a week)
> 
> I'm looking to take a packet that is incoming on my machine, on port 21
> and redirect it to port 3805 on a completely different external machine.
> Basically, I'm trying to solve how to make the machine a transparent
> proxy on the same external interface.  The packets coming in on port 21
> can be coming from anywhere on the internet, and will be sent to port
> 3805 on the remote machine, which then should come back through my box
> and back to the clients.
> 
> Any ideas on using iptables for this?  I dusted off redir and while it
> worked it had its occasional issues so I'm trying to bring a better
> hammer to beat on the nail.



      reply	other threads:[~2005-08-17  5:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-15 18:04 Redirecting packet from incoming external interface to a different external machine Jeffrey Carter
2005-08-17  5:03 ` Grant Taylor [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=4302C50E.7020408@riverviewtech.net \
    --to=gtaylor@riverviewtech.net \
    --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 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.