Re: DNAT to another Network?

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

 



On Wednesday 07 July 2004 12:51, Svavar Örn Eysteinsson wrote:
> Hi everybody.
>
> I have one question about DNAT.
>
> I have a computer foo.com on an ipaddress xxx.xxx.xxx.xxx
>
> Is there any way for me to DNAT all traffic with destination to foo.com
> to another server out-of-town, e.g. computer foobar.com with
> zzz.zzz.zzz.zzz that
> is not on my public network.?

Yes, basically using Computer A to be an IP-level proxy. Note that the source 
address as seen by Computer B will always be that of Computer A. If this is 
not a problem, you can use:

$IPTABLES -t nat -A PREROUTING -p tcp --dport 80 -d xxx.xxx.xxx.xxx -j DNAT 
--to zzz.zzz.zzz.zzz
$IPTABLES -A FORWARD -p tcp --dport 80 -d xxx.xxx.xxx.xxx j ACCEPT
$IPTABLES -t nat -A POSTROUTING -p tcp --dport 80 -d zzz.zzz.zzz.zzz -j SNAT 
--to xxx.xxx.xxx.xxx

Drop the '--dport 80' bits if you want all traffic, not just HTTP to be 
proxied.

Cheers,
Gavin.




[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