Hyper-V开的VPS虚拟机开启端口映射(主机到虚拟机)
技术分享|2017-8-9|最后更新: 2023-9-4
type
status
date
slug
summary
tags
category
icon
password
order
一、查询端口映射情况
netsh interface portproxy show v4tov4
说明:如果服务器内没做端口映射,就查询不出任何数据
查询某个IP所有的端口映射:
netsh interface portproxy show v4tov4 find "x.x.x.x"
说明上面的IP地址可以不加”“也可以查询;查询服务器的外网IP和虚拟主机的内网IP都可以。
二、增加一个端口映射
netsh interface portproxy add v4tov4 listenport=外网端口 listenaddress=公网IP connectaddress=内网IP connectport=内网IP端口
例如:
netsh interface portproxy add v4tov4 listenport=3399 listenaddress=x.x.x.x connectaddress=192.168.137.182 connectport=3389
另外:还要在母机的防火墙中开放被隐射的端口,如上面的33891端口;在虚拟机中也要开放3389端口。
三、删除一个端口映射
netsh interface portproxy delete v4tov4 listenaddress=公网IP listenport=内网端口
例如:
netsh interface portproxy delete v4tov4 listenaddress=x.x.x.x listenport=3399
 
Jquery模态框.Net Core Mvc中使用区域(Areas)