Re: Redirect local OUTPUT attempt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 28, 2005 at 12:50:08PM +0100, Tommy W wrote:
> I have a rather easy question , I hope !
> I'm trying to make a local connection attempt (specific port) to be redirected 
> to (local computer, different port)
> When configuring my gateway (another case and another computer)
> I can use
> iptables -t nat -I PREROUTING -s $IP -d $IP2 -p tcp -m tcp --dport 3434 -j 
> --to-destination $IP3:$PORT
> 
> that works perfectly, but it's not working now.. I guess it's because it's a 
> local connection (!?) as opposed to nat ,as it is in the gateway 
> configuration.
> What am I missing ?
> 
> I want 192.168.0.8:25 to be redirected to localhost:2525 basically.. (but only 
> locally)

to modify the destination of locally-generated packets--you need to
modify the OUTPUT chain of the NAT table.  also--your kernel needs to be
compiled with:

  CONFIG_IP_NF_NAT_LOCAL=y

and don't try and use 127.0.0.1--use:

  iptables -t nat -I OUTPUT -p tcp -d 192.168.0.8 --dport 25 \
    -j DNAT --to-destination 192.168.0.8:2525

-j

--
"Ah, beer, my one weakness. My achilles heel, if you will."
        --The Simpsons


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux