How to open port to nested VM

Jānis Simsons 101 Reputation points
2020-01-29T12:51:08.96+00:00

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: https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization-azure-virtual-network#install-and-configure-dhcp

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:
https://i.imgur.com/bjLK4wN.png
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
    2020-01-29T14:22:18.517+00:00

    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 0.0.0.0 -InternalIPAddress 10.4.2.2 -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