Windows 端口转发

显示已存在的转发策略

1
netsh interface portproxy show all

添加一条转发策略:

访问本机的4433端口将被转发到远程机47.100.107.8的443端口

1
2
3
4
5
6
7
8
9
10
11
12
13
14

C:\Windows\system32>netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=4433 connectaddress=47.100.107.8 connectport=443 //可以指定一个监听在本地的IP
C:\Windows\system32>netsh interface portproxy add v4tov4 listenport=4433 connectaddress=47.100.107.8 connectport=443

C:\Windows\system32>netsh interface portproxy show all

侦听 ipv4: 连接到 ipv4:

地址 端口 地址 端口
--------------- ---------- --------------- ----------
* 4433 47.100.107.8 443


C:\Windows\system32>

删除转发策略

1
2
3
4
5
6
7
8
C:\Windows\system32>netsh interface portproxy delete v4tov4 listenaddress=127.0.0.1 listenport=4433
C:\Windows\system32>netsh interface portproxy delete v4tov4 listenport=4433 //或者这样也行


C:\Windows\system32>netsh interface portproxy show all


C:\Windows\system32>