1. 程式人生 > >windows下埠對映(埠轉發)

windows下埠對映(埠轉發)

refs:

1.用windows的netsh實現

優點:

(1)部署簡單。Windows自帶,支援IPv4和IPv6

(2)不用重啟機器,還長記性。命令即時生效,重啟系統後配置仍然存在.

缺點:

(1)不支援UDP
(2)XP/2003需要先安裝IPV6,Win7以上系統自帶.

(1)安裝環境支援 netsh interface ipv6 install

(2)檢視已配置的“埠對映”清單 netsh interface portproxy show v4tov4

(3)新增“埠對映”

netsh interface portproxy add v4tov4 listenaddress=192.168.0.4 listenport=87 connectaddress=192.168.0.8 connectport=87

將本機(192.168.0.4)的87埠對映到192.168.0.8的87埠;

(4)刪除“埠對映”

netsh interface portproxy delete v4tov4 listenaddress=192.168.0.4 listenport=87