Total Pageviews

Friday 27 January 2012

IPtables 实现端口转发


将本机的88端口转发至其他主机
主机IP:1.1.1.1
目标主机IP和端口:2.2.2.2:80
iptables -t nat -A PREROUTING -p tcp -m tcp --dport 88 -j DNAT --to-destination 2.2.2.2:80

iptables -t nat -A POSTROUTING -p tcp -m tcp --dport 80 -j SNAT --to-source 1.1.1.1

service iptables save
保存
service iptables restart
重启。

No comments:

Post a Comment