Connecting VM NAT with Hyper-V
- Summary
- Creating a virtual switch
- Connection sharing
Summary
When you work in VMware Player or Workstation, it is possible to connect a VM in NAT network level. This allows the VM to hide on the physical host, while you can enjoy access to the local network that is connected to the physical host.
But when you work in Hyper-V, this possibility isn’t integrated. It can be a problem especially Hyper-V can be installed on client version of Windows, i.e. to say from Windows 8. In general with its workstation that acts as Hypervisor, it may connect to various networks (especially if it’s a laptop). In some cases, the network connection is complicated. Specifically on the command line when to authenticate to a proxy for a web page and that one has no GUI.
To work around this limitation and enjoy the NAT under Hyper-V, we will see here a whole technical functional flow.
The aim is to create a new virtual switch “Internal” in the Hyper-V console, and then make a connection between the virtual and physical network card connected through connection sharing concept. Then simply put a virtual machine on the new virtual switch that will be called “NAT” and will get a DHCP address by, and will access the LAN through NAT!
Creating a Virtual Switch
- Open the Hyper-V Manager, and on the right pane in the “Actions” Click “Virtual Switch Manager”.
- Click on “New Virtual Network Switch” and select “Internal”.
Name this virtual switch as desired and press “OK”. Calling it “NAT” sounds like a good name 🙂 !
The first stage is complete, move to the suite.
Connection Sharing
- On your host, go to Control Panel and click “Network and Sharing Center”.
- Select the card you want to make the connection (to connect “NAT”), such as “Wi-Fi”.
- Double-Click the “Name of the Connection”.
- The tab “Sharing – “enable” – Allow for other network users to connect through the Internet connection of your computer.
- Select “vEthernet” (NAT) which is the virtual that has just been created.
Note: This configuration uses the principle of hosted networks.
Confirm the configuration and close the network properties.
Note: If you enable sharing on your Wi-Fi card, it will reconfigure the share on the Ethernet Network Card you should need to user it. The rocker is not automatic and sharing can be active only one card for the same network.
It only remains to connect the virtual machine on the virtual switch called “NAT” and done!
We can also see from this virtual machine, the DHCP is active and that address is received, while checking that one is output from the Wi-Fi network adapter to ping the Internet.