前些日子有个端口转发的需求,正好有闲着的windows虚拟机,于是网上搜了个端口转发工具.用了一阵子发现各种问题.还是windows自带的工具好使,废话不多说了.
-
查看现有端口转发
netsh interface portproxy show all -
添加端口转发
1.格式:netsh interface portproxy add v4tov4 listenaddress=IPv4 addressorhostname listenport=integerorservicenameconnectaddress=IPv4 addressorhostnameconnectport=integerorservicenameprotocol=tcp参数 说明 listenaddres IPV4的监听地址,通过此地址转发 listenport IPV4的监听端口,通过此端口转发 connectaddress IPV4的连接地址,也就是真正提供服务的地址 connectport IPV4的连接端口,也就是真正提供服务的端口 protocol 目前只支持TCP协议,默认TCP可以不写 2.举个栗子:
netsh interface portproxy add v4tov4 listenaddress=192.168.1.1 listenport=5555 connectaddress=10.10.10.10 connectport=6666 -
删除端口转发
1.格式:netsh interface portproxy delete v4tov4 listenaddress=IPv4 addressorhostname listenport=integerorservicename
2.举个栗子:
netsh interface portproxy add v4tov4 listenaddress=192.168.1.1 listenport=5555 connectaddress=10.10.10.10 connectport=6666
- 修改端口转发
1.格式:netsh interface portproxy set v4tov4 listenaddress=IPv4 addressorhostname listenport=integerorservicenameconnectaddress=IPv4 addressorhostnameconnectport=integerorservicenameprotocol=tcp
2.举个例子
netsh interface portproxy set v4tov4 listenaddress=192.168.1.1 listenport=7777 connectaddress=10.10.10.10 connectport=8888
熟悉了这几条命令一般的端口转发需求应该就可以应付了.加粗样式