Configure Hyper-V NAT Virtual Switch and NAT Forwarding

Configure Hyper-V NAT Virtual Switch and NAT Forwarding

Windows Server 2016 and Windows 10 adds the native ability for a NAT forwarding Hyper-V switch. This is really handful software-defined networking (SDN) or even lab environment. By default, there is no inbound access from the LAN to the virtual machines that are connected to an NAT-enabled (Internal) virtual switch. And you might want to access isolated virtual machines in your lab through RDP with your laptop. Actually, the old way was to create a specific virtual machine in this lab to act as a gateway. You can find more information in Microsoft documentation.

To create a new NAT switch using subnet on your Hyper-V host, use these PowerShell commands:

Of course, you will need to map your virtual machine network adapter to the right virtual switch and assign an IP in this subnet to your virtual machine and set address as the default gateway. Then if you want to access this virtual machine through RDP for example, run this PowerShell command:

With this configuration, you will be able to connect to your isolated lab virtual machine (IP: through your host “public” IP and the port 50000 using RDP without additional VM to configure.

You will need to configure the firewall of the Hyper-V host (and even maybe your router if pointing to a public address) accordingly to the NAT mapping rule.
Multiple NAT networks are not supported.

3 thoughts on “Configure Hyper-V NAT Virtual Switch and NAT Forwarding

  1. Is it possible to map a Range of Ports? Similar to:

    Add-NetNatStaticMapping -NatName NATnetwork -Protocol TCP -ExternalIPAddress “” -InternalIPAddress -InternalPort 50000-51000 -ExternalPort 50000-51000

Leave a Reply

Your email address will not be published. Required fields are marked *