Allen Kistler <(E-Mail Removed)> wrote in news:iU2ig.42536$fb2.10654
@newssvr27.news.prodigy.net:
> Llanzlan Klazmon wrote:
>> "Ross" <(E-Mail Removed)> wrote in
>> news:tKadnRV7y-(E-Mail Removed):
>>
>>
>>>Hi there,
>>>I am running iptables 1.2.7 on my Linux box as a firewall.
>>>I have a web server https://www.company.com:8064/ running well on this
>>>Linux box to Internet.
>>>Now, I want any client request https://www.company.com/ (port 443) to be
>>>redirected/forwarded to port 8064.
>>>How could I run iptables to do this?
>>>Thanks in advance,
>>>Ross
>>>
>>>
>>>
>>
>>
>> I believe you can use DNAT in the PREROUTING chain to do that.
>>
>> [snip]
>
> Actually you need to use REDIRECT in the PREROUTING chain, using the
> --to-ports option.
>
The Man page says:
---------------------------------------------------------------------------
--
REDIRECT
This target is only valid in the nat table, in the PREROUTING and OUTPUT
chains, and user-defined chains which are only called from those chains. It
alters the destination IP address to send the packet to the machine itself
(locally-generated packets are mapped to the 127.0.0.1 address). It takes
one option:
--to-ports <port>[-<port>]
This specifies a destination port or range or ports to use: without
this, the destination port is never altered. This is only valid with if the
rule also specifies -p tcp or -p udp).
------------------------------------------------------------------------
Maybe I am misunderstanding this but it suggests that the destination IP
address is changed to send the packet to the machine itself but what
happens if there are multiple ip addresses on the incoming interface? Which
one does the incoming packet get sent to. If the OP is running more than
one web site with different IP addresses then there doesn't appear to be a
way using REDIRECT to specify the correct destination IP, whereas DNAT does
let you do this. Maybe it would be ok if it leaves the original destination
alone if it already corresponds to a local address. Must try this out to
see.
Klazmon.
Klazmon.