查询

netsh interface portproxy show all

netsh interface portproxy show v4tov4 | find "[IP]"

新增

netsh interface portproxy add v4tov4 listenaddress=[外网IP] listenport=[外网端口] connectaddress=[内网IP] connectport=[内网端口]

新增或修改(本机)

netsh interface portproxy set v4tov4 listenport=[外网端口] connectaddress=[内网IP] connectport=[内网端口]

删除(本机)

netsh interface portproxy delete v4tov4 listenport=[外网端口]

xp或2003系统需先安装ipv6

netsh interface ipv6 install

开放防火墙端口

netsh advfirewall firewall add rule name="[规则名]" protocol=TCP dir=in localip=[外网IP]  localport=[外网端口] action=allow