1.用windows的netsh实现
优点:
(1)部署简单。Windows自带,支持IPv4和IPv6
(2)不用重启机器,还长记性。命令即时生效,重启系统后配置仍然存在.
缺点:
(1)不支持UDP
(2)XP/2003需要先安裝IPV6,Win7以上系统自带.
执行命令:
(1)安装环境支持(如果已经安装IPV6,可以不执行)
netsh interface ipv6 install
(2)查看已配置的“端口映射”清单
netsh interface portproxy show v4tov4
(3)添加端口映射
netsh interface portproxy add v4tov4 listenaddress=10.139.1.30 listenport=13016 connectaddress=172.16.13.16 connectport=22
(4)查看已经配置的端口转发
netsh interface portproxy show v4tov4
(5)删除端口映射netsh interface portproxy delete v4tov4 listenaddress=10.139.1.30 listenport=13016