How to open port to nested VM

Jānis Simsons 101 Reputation points

I have a windows server VM in Azure that is running a Hyper-V VM on top of it.
The nested VM is running a database server on port: 1025

How can I connect to the nested VM's database from outside the network?

I followed this MS article on setting up routing:

That helped with connectivity from nested VM to the internet. But I cannot connect to the nested VM from outside.

I tried creating a NAT port redirection rule under "Routing and Remote Access" -> IPv4 -> NAT -> 'Services and Ports' like this:
But that didn't help.

What else needs to be configured?

Thank you

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,406 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jānis Simsons 101 Reputation points

    I fixed this issue.
    If anyone else is looking for a solution you must add NAT static mapping with powershell:

    Add-NetNatStaticMapping -NatName "NestedSwitch" -Protocol TCP -ExternalIPAddress -InternalIPAddress -InternalPort 1025 -ExternalPort 1025

    "NestedSwitch" is the virtual switch which is created if you follow the MS article mentioned in the post above.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful