In our example, we'll be setting a virtual switch and NAT rule called Unit35.co on subnet 192.168.35.0/24.
Step 1. Create a "Internal" VM Switch
Start PowerShell as an administrator on your Hyper-V host a create an internal virtual switch with the following command.
New-VMSwitch -Name "Unit35.co" -SwitchType Internal
Step 2. Create a Private IP Network for NAT
Next, define the internal subnet that we are going to be using for NAT.
New-NetNat -Name Unit35.co -InternalIPInterfaceAddressPrefix 192.168.35.0/24
Step 3. Assign a Default Gateway IP Address
Finally assign an IP address from the internal subnet that we just defined to be our gateway to the virtual switch we created earlier.
New-NetIPAddress -IPAddress 192.168.35.1 -PrefixLength 24 -InterfaceAlias "vEthernet (Unit35.co)"
Note: There are a few things that you'll need to be aware of when NAT is set up. Current builds of Windows 10 and Windows Server 2016 appear to only allow you to have one NAT network. The other thing to note is that NAT switches do not provide DHCP or DNS services to your NAT network. You'll need to setup a virtual machine on that network for those services.