Set Up NAT In Windows 10 Hyper-V

Windows 10 has a feature that allows to create NAT network in Hyper-V and put virtual machines behind the NAT. The steps to implement this are based on the Set up a NAT network article, I’ve reorganized it for simplicity.

All the steps must be performed from PowerShell console being run as Administrator.

1. Create Virtual Switch

My virtual switch will be named NAT, you will see it in Hyper-V manager. If everything is OK, you’ll see the following:

2. Find the interface index

Remember the ifIndex of a newly created virtual switch (named NAT).

3. Configure the NAT gateway

I will use subnet 172.16.0.x with mask 255.255.255.0. In this command you specify the IP address of the NAT default gateway 172.16.0.1 with 1 in the last position.

4. Create NAT network

In this command you specify subnet 172.16.0.0 with 0 in the last position.

 

Now you can check virtual switch. When you open Control Panel -> Network and Internet -> Network Connections, you will see adapter “vEthernet (NAT)”. It must be set to IP address 172.16.0.1 and subnet mask 255.255.255.0.

Inside virtual machine you should set up TCP/IPv4 properties for network adapter manually like this:

IP Address 172.16.0.2 or any other IP up to 172.16.0.254
Subnet mask 255.255.255.0
Default gateway 172.16.0.1
DNS server Place IP address of DNS server that is used on host network adapter, i.e. 192.168.1.1 or 8.8.8.8