Mirror site is read only www.netnr.com
netnr/ netsh-interface.bat 2019-03-29 14:23
windows使用netsh命令实现端口转发
::安装IPv6,XP或更低版本要安装,安装后不需要启用,win7及以上不需要
netsh interface ipv6 install

::添加端口转发 192.168.1.2:1433 => 192.168.1.3:1433
netsh interface portproxy add v4tov4 listenaddress=192.168.1.2 listenport=1433 connectaddress=192.168.1.3 connectport=1433

::添加端口转发 *:1433 => 192.168.1.3:1433 不设置listenaddress
netsh interface portproxy add v4tov4 listenport=1433 connectaddress=192.168.1.3 connectport=1433

::删除端口转发 192.168.1.2:1433
netsh interface portproxy delete v4tov4 listenaddress=192.168.1.2 listenport=1433

::删除所有端口转发(重置)
netsh interface portproxy reset

::查询端口转发列表
netsh interface portproxy show all