Windows下用netsh命令实现端口转发(端口映射)

首先安装IPv6(XP下IPv6必须安装,否则端口转发不可用)

netsh interface ipv6 install

添加一个IPv4到IPv4的端口转发

netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=0 connectaddress=0.0.0.0 connectport=0

删除端口转发

netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=0

查看存在的转发

netsh interface portproxy show all

来源:http://blog.phpdr.net/windows%E5%91%BD%E4%BB%A4%E8%A1%8C%E4%B8%8B%E7%94%A8netsh%E5%AE%9E%E7%8E%B0%E7%AB%AF%E5%8F%A3%E8%BD%AC%E5%8F%91%E7%AB%AF%E5%8F%A3%E6%98%A0%E5%B0%84.html