我在家里有2个互联网连接。 我冲浪他们两个:每隔一个连接开关isp。
我已经使用我的VPS作为冲浪的常规代理,确保我总是有相同的IP地址为特定的网站。
但是:我不能使用某个Usenet程序的代理,所以我想在我的VPS上设置一个端口作为非常具体的代理。 我怎么做?
我试过这个规则:
iptables -A FORWARD -p tcp -i eth1 -o eth1 -d 256.256.256.256 --dport 563 -m state --state NEW -j ACCEPT ACCEPT tcp -- anywhere usenet-server.com tcp dpt:nntps state NEW ACCEPT udp -- anywhere usenet-server.com udp dpt:nntps state NEW
但他们不工作。
这个诀窍:
YourIP=1.2.3.4 YourPort=80 TargetIP=2.3.4.5 TargetPort=22 iptables -t nat -A PREROUTING --dst $YourIP -p tcp --dport $YourPort -j DNAT \ --to-destination $TargetIP:$TargetPort iptables -t nat -A POSTROUTING -p tcp --dst $TargetIP --dport $TargetPort -j SNAT \ --to-source $YourIP iptables -t nat -A OUTPUT --dst $YourIP -p tcp --dport $YourPort -j DNAT \ --to-destination $TargetIP:$TargetPort
非常感谢这篇文章: http : //www.debian-administration.org/articles/595