September 18, 2019

Hyper-V Virtual NAT Switch Setup

Setting up a virtual NAT network for Hyper-V virtual machines.


When setting up virtual machines on a single host that need to be interconnected, it can be extremely useful to have your own virtual network where the machines can have static IP addresses that won't change, even if the host machine is connected to different networks. To accomplish this on Hyper-V, you can create a new virtual switch that uses NAT.


Launch a new PowerShell session as an administrator.

Create the new virtual switch for an "Internal" network:

New-VMSwitch -SwitchName "NATSwitch" -SwitchType Internal

Assign an IP address to the new switch device:

New-NetIPAddress -IPAddress -PrefixLength 24 -InterfaceAlias "vEthernet (NATSwitch)"

Set up NAT:

New-NetNAT -Name "NATNetwork" -InternalIPInterfaceAddressPrefix

Now, you can attach your virtual machines to the new switch and configure them with static IP addresses. If you used the commands above verbatim, then you can pick any addresses from through


This virtual NAT network does not have DHCP or DNS services. Unless you set these up separately, you will need to configure static IP addresses and DNS servers on virtual machines attached to this virtual network.