Sometimes in order to let local area network or extranet users directly access or access the virtual machine services, the real port can be directly mapped to Hyper-V virtual machine inside, save a lot of trouble.
Here are some common commands for Hyper-V shared IP port mapping
Shared IP port mapping some common commands
First, the query port mapping situation
netsh interface portproxy show v4tov4
Query all port mappings for this IP.
netsh interface portproxy show v4tov4|find "192.168.1.1"
Second, add a port mapping
netsh interface portproxy add v4tov4 listenport= extranet port listenaddress= primary IP connectaddress= private IP connectport= Private IP port
For example:
netsh interface portproxy add v4tov4 listenport=8888 listenaddress=118.123.13.180 connectaddress=192.168.1.10 connectport=2222
Third, remove a port mapping
netsh interface portproxy delete v4tov4 listenaddress= primary IP listenport= External network port
Hyper-V Port mappings