关于iptables 的ip影射和透明代理

由 pblue 在 02-03-2004 11:38 发表:

关于iptables 的ip影射和透明代理

我做的iptables规则,目的是为了让内网机器192.168.1.10/192.168.1.20/192.168.1.30这三台机器有对外的ip

同时让局域网内的其他机器能进行透明代理上网

服务器网卡已经绑定了4个ip.其中228那个网关服务器自己用,其他的三个分别给不同的服务器。

用了如下的iptables规则,但是我在192.168.1.30的机器上面开oicq,看自己的ip还是218.27.10.228。而不是218.27.10.231

别人看也是218.27.10.231。但访问218.27.86.231可以访问到192.168.1.30这台机器。

高手帮忙看看。。困扰了好几天了。

iptables -F

iptables -t nat -F

iptables -t nat -A PREROUTING -d 218.27.10.229 -j DNAT --to 192.168.1.10

iptables -t nat -A PREROUTING -d 218.27.10.230 -j DNAT --to 192.168.1.20

iptables -t nat -A PREROUTING -d 218.27.10.231 -j DNAT --to 192.168.1.30

iptables -t nat -A POSTROUTING -d 192.168.1.10 -s 192.168.1.0/24 -j SNAT --to 218.27.10.229

iptables -t nat -A POSTROUTING -d 192.168.1.20 -s 192.168.1.0/24 -j SNAT --to 218.27.10.230

iptables -t nat -A POSTROUTING -d 192.168.1.30 -s 192.168.1.0/24 -j SNAT --to 218.27.10.231

iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth1 -j SNAT --to 218.27.10.228

iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128


由 harrypo

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus