netsh
,使用
netsh interface portproxy
指令,新增和修改配置信息後,即時生效,而且重啓系統後配置信息仍然存在,很是方便。適用於WindowsXP、Windows7,其餘的版本尚未試過,支持IPv4和IPv6,可是隻支持TCP協議。
以netsh interface portproxy add v4tov4
爲例,其語法格式以下:程序員
netsh interface portproxy add v4tov4 [listenport=]<integer>|<servicename>
[connectaddress=]<IPv4 address>|<hostname>
[[connectport=]<integer>|<servicename>]
[[listenaddress=]<IPv4 address>|<hostname>]
[[protocol=]tcp]windows
netsh interface portproxy add v4tov4 listenport=8080 connectaddress=192.168.56.101 connectport=8080
tcp
netsh interface portproxy add v4tov4 listenport=9090 connectaddress=192.168.56.101 connectport=9090
將本地的9090端口的數據轉發至192.168.56.101上的9090端口。
netsh interface portproxy show all - 顯示全部端口代理參數。
netsh interface portproxy show v4tov4 - 顯示 IPv4 代理鏈接到另外一個 IPv4 端口的參數。
netsh interface portproxy show v4tov6 - 顯示 IPv4 代理鏈接到 IPv6 的參數。
netsh interface portproxy show v6tov4 - 顯示 IPv6 代理鏈接到 IPv4 的參數。
netsh interface portproxy show v6tov6 - 顯示 IPv6 代理鏈接到另外一個 IPv6 端口的參數。spa
netsh interface portproxy show all
代理
netsh interface portproxy set v4tov4 - 更新經過 IPv4 的 IPv4 和代理鏈接到的偵聽項目。
netsh interface portproxy set v4tov6 - 更新經過 IPv6 的 IPv4 和代理鏈接到的偵聽項目。
netsh interface portproxy set v6tov4 - 更新經過 IPv4 的 IPv6 和代理鏈接到的偵聽項目。
netsh interface portproxy set v6tov6 - 更新經過 IPv6 的 IPv6 和代理鏈接到的偵聽項目。code
以netsh interface portproxy set v4tov4
爲例,其語法格式以下:blog
netsh interface portproxy set v4tov4 [listenport=]<integer>|<servicename>
[connectaddress=]<IPv4 address>|<hostname>
[[connectport=]<integer>|<servicename>]
[[listenaddress=]<IPv4 address>|<hostname>]
[[protocol=]tcp]ip
參數:
標記 值
listenport - IPv4 偵聽端口。
connectaddress - IPv4 鏈接地址。
connectport - IPv4 鏈接端口。
listenaddress - IPv4 偵聽地址。
protocol - 使用的協議。如今只支持 TCP。
說明: 更新經過 IPv4 的 IPv4 和代理鏈接到的偵聽項目。開發
netsh interface portproxy set v4tov4 listenport=9090 connectaddress=192.168.56.101 connectport=9080
get
將本地9090端口改爲轉發至192.168.56.101的9080端口中。
以netsh interface portproxy delete v4tov4
爲例,其語法格式以下:
netsh interface portproxy delete v4tov4 [listenport=]<integer>|<servicename>
[[listenaddress=]<IPv4 address>|<hostname>]
[[protocol=]tcp]
netsh interface portproxy delete v4tov4 listenport=9090
刪除本地端口9090的端口轉發配