How to Connect Virtual Machine to Internet in Hyper-V
It is easy and simple to configure virtual machines created on Hyper-V to access our physical network
How to Connect the VM to the Internet on Hyper-V
After installing a virtual machine on Hyper-V, the first thing to do is to create a Network Adapter using Virtual Switch Manager and add this network card to the virtual machine.
Virtual Switch Manager can be used in different scenarios according to your network topology. However, you can apply two different methods for the virtual machine Internet connection. You can use the following two methods for the Internet connection.
- Adding only one External Virtual Switch to the virtual machine.
- Adding both Internal and External Virtual Switch to the virtual machine.
In this article, the solution we will use to connect the virtual computer to the Internet is the 2nd method.
How to Create Internal and External Virtual Switch on Hyper-V
Follow the steps below in order for the virtual machine Internet settings.
Step 1
Run the Hyper-V Manager virtualization program.
Step 2
Click the Virtual Switch Manager from the Actions panel.
Step 3
First, add the Internal Virtual Switch to the virtual machine.
Step 4
Name the Internal Virtual Key and then click the OK button.
Step 5
For example, to add a network adapter for the Windows 7 virtual machine, right-click on the virtual machine and select the Internal Virtual Switch created by clicking the Network Adapter in the left panel of the pop-up window and click OK.
Step 6
Connect and run the Windows 7 virtual machine.
Step 7
When opening the virtual machine, configure the TCP/IP configuration of the vEthernet network card created by Hyper-V on your physical computer as follows.
Step 8
Configure the TCP/IP settings of the Windows 7 VM as shown in the image below.
Step 9
Pinging from the virtual machine to the default gateway (192.168.10.1) will succeed as follows.
Step 10
From Step 1 to Step 9, we actually configured an Internal Virtual Switch. The reason for this is to show you how to get an Internal VM to the Internet.
In this step, we will add an External Virtual Switch to the Internal VM and bring it to the Internet. Open Virtual Switch Manager in the same way and select External as below and click Create Virtual Switch.
Step 11
Type a name for the External Virtual Switch and also fill in the description. When adding an external network, you must select the network card of your physical machine connected to the Internet.
Step 12
Open the Windows 7 machine network settings again and add a new Network Adapter by clicking Add Hardware as follows.
Step 13
Add the External Virtual Switch that you created to the virtual machine.
Step 14
Check the virtual machine network settings. It needs to get an IP address from our local network as in the image below. If it does not obtain an automatic IP address, you may need to check your DHCP settings.
Step 15
Run the CMD command prompt on the Windows 7 machine and test the Internet connection by pinging the Modem IP address to the Google DNS server.
Step 16
Finally, you can check the VM Internet connection by viewing any website by opening an Internet browser from the virtual machine.
How to Configure Internet Settings in Hyper-V ⇒ Video
Final Word
In this article, we examine step by step how to configure a virtual machine Internet connection on Windows 10 operating system using Microsoft virtualization program. Thanks for following us!
Related Articles
♦ How to Install Hyper-V on Windows 10
♦ How to Enable Hyper-V using Powershell
♦ How to Configure Hyper-V using CMD
♦ How to Install Windows 10 in Hyper-V
♦ How to Install Windows 7 in Hyper-V
I followed the steps but ping fails. I am running hyperventilate in Windows 10 and guest is server 2012 r2.
I am curious how you would have multiple VMs to the switch while acquiring unique IP addresses from your DHCP/Router to access the internet. I am stumped on this currently.
Hello, AaronW!
By simply adding “External Switch” to your VMs in Hyper-V, you can get them all on the Internet. In short, you have to follow after Step 10.
If you want to try different network scenarios, you must add Internal Switch. For example, you can add 2 NICs to a server and enable the IP Routing service and then connect two different IP blocks (192.168.10.0/24 – 192.168.20.0/24) with each other.