Hyper is an open-source, decentralized hosting platform that allows anyone to easily share their unused computing power with others. Developed by the team at GitHub, Hyper provides a new way of sharing resources which helps developers and companies build applications more efficiently. This article will walk you through how easy it is to get started on your own project with Hyper.
Hyper-V is a technology that enables virtualization on the Windows operating system. In order to use Hyper-V, you must first set it up. The “how to enable hyper-v” article will walk you through the process of setting up Hyper-V.
Do you need many hosts to set up a lab? Or do you want to test an application in a controlled environment? Nested virtualization with Hyper-V might be the solution you’re looking for. Hyper-V is a built-in feature or function in Windows that you just have to activate before you can use it. It’s also completely free!
Continue reading to discover how to set up Hyper-V to support layered virtualization. You will have constructed, installed, and configured nested virtual machines (VMs) with one physical host by the Conclusion of this tutorial. Let’s get started!
Prerequisites
This essay takes a step-by-step method. You’ll also need the following items to follow along with the instructions.
- Hardware virtualization requires a host (physical) system with a CPU that supports it (VT-x, AMD-V).
- To run Hyper-V virtual machines, the host system must have adequate memory. The virtual machine in this tutorial will have 4GB of RAM.
- The host operating system (OS) must be Windows Server 2016, Windows 10 version 1607 (Anniversary Update), or later for hosts with Intel CPUs. The minimal operating system for AMD-powered hosts is Windows 10 Build 19636. The version of Windows 10 Pro 20H2 will be used in this tutorial.
- An ISO file for installing an operating system. The ISO filename for the OS installation in this post is c:ISOwindows server 2016.iso. This ISO file will be used to install the nested VM guest OS.
- Depending on your host’s operating system, choose Hyper-V for Windows 10 or Hyper-V for Windows Server. Hyper-V on a Windows 10 host is used in this article.
Putting Together A NAT-Capable Virtual Switch
To set up Hyper-V nested virtualization, you must first construct a network that allows VMs on a host to interact with one another. To do so, you’ll need to set up a NAT-enabled virtual switch that will be used by all VMs to connect to the Internet.
A NAT-enabled virtual switch named Default Switch already exists on a Windows 10 Hyper-V host. But, even if your host OS is Windows 10, presume that the Default Switch does not exist on your Hyper-V host to have an end-to-end Hyper-V nested virtualization arrangement.
Follow these instructions to establish a NAT-enabled virtual switch.
1. Open PowerShell as an administrator on your Hyper-V host PC.
How to Run PowerShell as an Administrator is a related topic.
2. Then, in PowerShell, use the command below to establish a new internal virtual switch named vNAT.
When you create a virtual switch, Windows creates a new virtual network adapter named vEthernet (vmSwitchName), where vmSwitchName is the name of the virtual switch.
Because the virtual switch is called vNAT in this case, the new virtual network adapter is called vEthernet (vNAT).
# Make a new virtual switch with the new vNAT and an Internal type. This program also generates a virtual network adapter named “vEthernet (vNAT)” by default. vNAT -SwitchName New-VMSwitch -SwitchType Internal
3. Run the command below in PowerShell to assign an IP address and subnet mask to the vEthernet (vNAT) network device. The network adapter will be given the IP address 192.168.200.1 with the subnet mask 255.255.255.128 (/25) by this command.
This command’s IP address and subnet mask are only samples and may not apply to your situation. Choose a subnet mask that isn’t currently in use on your home or workplace network to prevent connection troubles.
# Give the “vEthernet (vNAT)” network adapter an IP address and a subnet. -IPAddress 192.168.200.1 -PrefixLength 25 -InterfaceAlias “vEthernet (vNAT)” New-NetIPAddress -IPAddress 192.168.200.1 -PrefixLength 25 -InterfaceAlias “vEthernet (vNAT)”
4. Next, on your Hyper-V host, establish a NAT object that will convert your VM’s internal network address. To do so, use PowerShell and perform the command below.
# For the internal IP address of the virtual switch, create a new NAT object named vNATNetwork in Windows. New-NetNat -Name vNATNetwork -InternalIPInterfaceAddressPrefix 192.168.200.0/25 -Verbose
Creating a Guest Virtual Machine at the First Level
To set up Hyper-V nested virtualization, first construct and configure the first-level virtual machine, which will ultimately be a Hyper-V host. This first-level virtual machine will be referred to as L1-VM in this tutorial.
Hyper-V Manager (GUI) and PowerShell are the two ways to construct a virtual machine. The virtual machine will be created in the same way using either approach.
Method 1: Using the Hyper-V Manager to create a virtual machine
Follow these procedures to construct the L1-VM using Hyper-V Manager.
1. On your host machine, open the Hyper-V Manager. To do so, click on Start —> Windows Administrative Tools —> Hyper-V Manager.
Hyper-V Manager is launched.
2. Once the Hyper-V Manager window is open, on the Action pane, click New —> Virtual Machine.
A new virtual machine is being created.
3. On the Before You Begin screen of the New Virtual Machine Wizard, click Next.
On the Before You Begin page, click Next.
4. In the Name box on the Specify Name and Location screen, input the name of the new virtual machine. L1-VM is the name of the virtual machine in this case.
Put a check in the Store the virtual machine in a different place box, then browse or input the path in the Location box if you need to alter the new VM’s location. The wizard will create the folder path you select if it does not exist.
When you need to pick a site with suitable storage capacity, changing the VM location is beneficial. Alternatively, you may arrange the VMs in your favorite folder.
Otherwise, uncheck the box to accept the default location. The new VM’s location in this case is C:Hyper-V. After setting the VM name and location, click Next.
Defining the name and location of the new virtual machine
5. Select the VM generation version on the Specify Generation screen. The choices are as follows:
Generation 1 — From Windows 7 and Windows Server 2008 forward, it supports both 32-bit and 64-bit guest operating systems. A Generation 1 virtual machine will be used in this experiment.
Generation 2 — From Windows 8 and Windows Server 2012 forward, only 64-bit guest operating systems are supported. The firmware of this iteration is likewise UEFI-based. Click Next once you’ve chosen a VM generation.
Choosing a virtual machine generation
6. On the Assign RAM tab, enter the amount of memory you want to provide the VM. The VM is given 4GB (4096 MB) of RAM in this case.
7. For this virtual machine, uncheck the Use Dynamic Memory option. Dynamic memory is not supported by Hyper-V nested VMs. After you’ve finished configuring the RAM, click Next.
Assigning the new VM’s memory size
8. Select the virtual switch called vNat that you built previously in this article on the Configure Networking page.
Choosing a virtual switch
9. On the Connect Virtual Hard Disk screen, you can:
- Create a virtual hard drive (VHD) — This option allows you to name, locate, and size a new virtual hard disk (VHD). You’ll have to install an operating system subsequently since the new VHD will be empty.
- Use an existing virtual hard drive — Rather of establishing a new VHD, this option allows you to choose an existing VHD (if you have one) to connect to the VM.
- Attach a virtual hard drive later – If you wish to skip this stage and continue constructing the VM without a VHD, choose this option. After you’ve built the VM, you may still build a new VHD or connect an existing VHD.
This example chooses Create a virtual hard drive and uses the default choices for name, location, and size. If you like, you may change these settings. After you’ve made your decision, click Next.
Connecting a Virtual Hard Disk to a Computer
Choose how you want to install the operating system (OS) on the Installation Options page:
In this case, the VM will use the bootable CD/DVD-ROM option to install the OS. The installation medium for Windows Server 2016 is an ISO file named C:ISOwindows server 2016.iso. Click Next after you’ve chosen your decision.
Choosing a method for The operating system is being installed.
11. Finally, evaluate the new VM’s description on the Completing the Wizard for Creating a New Virtual Machine page. Click Finish when you’re certain you haven’t missed any steps.
Completing the Wizard for Creating a New Virtual Machine
12. Increasing the VM’s processor count after it has been formed is optional, although it is suggested to increase the VM’s performance. To do so, pick the VM and then go to the Action pane’s Settings menu.
Changing the virtual machine’s settings
13. In the Settings box, go to the left pane and select Processor. Increase the number of virtual processors after that. The new processor count in this case is two. If your host has the capability, you may allocate additional.
Increasing the number of virtual machine processors
Method 2: Using PowerShell to Create a Virtual Machine
Instead of going through numerous stages in Hyper-V Manager to build a VM, you may use PowerShell to construct a Hyper-V VM.
Follow the instructions below to build and configure a new virtual machine.
1. Run PowerShell as an administrator on the Hyper-V host machine.
2. Next, execute the PowerShell code below to build a new virtual machine named L1-VM. Splatting is used in the code snippet below to prepare the new VM’s parameter settings. To learn what each parameter performs, look at the inline comments.
Splatting in PowerShell: What Is It and How Does It Work?
# Set up the properties for the new VM. @$newVM splat = $newVM splat # Give the new VM a name. # Set the VM’s generation version to generation 1 with the name ‘L1-VM’. 1st generation # Set the memory capacity of the virtual machine to 4GB MemoryStartupBytes = 4GB # Select CD as the boot option. ‘CD’ is the default boot device. # Set the vNAT virtual switch that the VM will connect to. ‘vNAT’ is the name of the switch. Set the location where the new VM will be created. Path = ‘C:Hyper-VL1-VM’ # This is where the new VM’s virtual hard drive will be created. ‘C:Hyper-VL1-VMVHDL1-VM.vhdx’ as NewVHDPath # Set the size of the new virtual hard drive to 100GB. # Create a new VM with NewVHDSizeBytes = 100GB. @newVM splat @newVM splat @newVM splat @newVM spla
Using PowerShell to create a virtual machine
3. Run the command below to raise the VM’s processor count once it has been created. A new VM’s default processor count is 1, which may cause it to operate slowly. The following command raises the CPU count to two. If your host allows it, you may add more.
# Increase the number of processors in the virtual machine to two. If your host has the resources, you may boost the CPU. Set-VM -VMName L1-VM -ProcessorCount 2 Set-VM -VMName L1-VM -ProcessorCount 2
4. Finally, use the command below to deactivate dynamic memory on the VM. Dynamic memory is not supported by Hyper-V nested virtualization.
# Turn off the VM’s dynamic memory. Set-VMMemory -VMName L1-VM -DynamicMemoryEnabled Set-VMMemory -VMName L1-VM -DynamicMemoryEnabled Set-VMMemory $false
5. Mount the ISO file to the VM’s DVD drive using the command below. This ISO file will be used to install the operating system on L1-VM later.
# Set the path to the ISO file so that it may be mounted on the VM’s DVD drive. Set-VMDvdDrive -VMName L1-VM -Path C:ISOwindows server 2016.iso Set-VMDvdDrive -VMName L1-VM -Path C:ISOwindows server 2016.iso
Nested Virtualization Enablement
To enable nested virtualization in Hyper-V, you must expose the virtual machine to the host’s virtualization extensions, such as VT-x for Intel and AMD-V for AMD. These virtualization extensions enhance the capability of a virtual machine’s logical processors, allowing it to virtualize an existing virtualized CPU.
Invoke the Set-VMProcessor cmdlet to activate the virtualization extension, as illustrated below.
1. Log in to your Hyper-V host system as an administrator and run PowerShell.
2. Next, paste the code below into PowerShell and execute it. The virtualization extensions on the virtual processor of the VM will be enabled using this command.
# Enable the virtualization extensions for the VM. Set-VMProcessor -VMName L1-VM -ExposeVirtualizationExtensions Set-VMProcessor -VMName L1-VM -ExposeVirtualizationExtensions $true
3. Finally, execute the command below in PowerShell to verify that the operation was successful. This command returns the value of the ExposeVirtualizationExtensions property of the VM processor. As you can see in the picture below, the value should be True.
Nested Virtualization Enablement
The Guest Operating System Is Installed
It’s time to install the operating system on the soon-to-be Hyper-V host now that you’ve constructed the first-level (soon-to-be virtualized Hyper-V host) guest VM and specified its parameters. To do so, follow the steps below.
1. On your Hyper-V host, launch Hyper-V Manager.
2. Click Connect after selecting the VM name, in this case L1-VM. The Virtual Machine Connection window will open as a result of this action.
Connecting to the Virtual Machine
3. To start the virtual machine, click Start in the Virtual Machine Connection box.
Starting the Virtual Machine
4. Complete the operating system installation now.
The operating system is being installed.
Getting On The Internet
You’ll notice that the network status in the system tray displays a caution indication after you’ve installed the operating system on the VM. This warning icon indicates that the virtual machine is not connected to the network and has no internet connection.
VM does not have access to a network or the internet.
You must specify an IP address, subnet mask, default gateway, and DNS address to the network adapter settings on L1-VM to fix this problem. Follow these instructions to do so.
1. Right-click the Start button on L1-VM and choose Run.
2. In the Open box, type control ncpa.cpl and click OK. The Network Connections applet will be launched with this command.
The Network Connection Control Panel applet is launched.
3. There should only be one network adapter named Ethernet in the Network Connections applet window by default. Right-click Ethernet and choose Properties from the drop-down menu.
Changing Ethernet settings
4. On the Ethernet Properties screen, click to highlight (DO NOT UNCHECK!!!) Internet Protocol Version 4 and then click the Properties button.
Accessing IPv4 Properties
5. Select Use the following IP address from the Internet Protocol Version 4 (TCP/IPv4) Properties window and fill in the entries for:
- IP address – Type in the IP address you’d want to provide L1-VM. The IP address you input must be inside the range of the Hyper-V virtual switch you built. The vNAT virtual switch IP range, for example, is 192.168.200.0/25, resulting in an IP address range of 192.168.200.2 to 192.168.200.126. The IP address for L1-VM in this case is 192.168.200.2.
- Subnet mask – Enter the IP address range of the virtual switch’s netmask address. The subnet mask for 192.168.200.0/25 is 255.255.255.128.
- Default gateway — Type in the virtual switch’s IP address. The IP address of the virtual switch in this case is 192.168.200.1.
6. Next, type in the IP address of your preferred DNS server. Use that address if you have a DNS server, such as one in your home or workplace network. Otherwise, a public DNS server address may be used. The DNS server address in this case is 8.8.8.8, which is Google’s public DNS server.
If necessary, you may also add an Alternate DNS server. However, in this case, the desired DNS server is sufficient. Click OK after you’ve finished configuring the network address.
Setting up IPv4 settings
To implement the changes, return to the Ethernet Properties box and click Close.
The Ethernet Properties window is closed.
The network status has now been set to connected.
The virtual machine has network and internet connectivity.
8. Finally, start a web browser on L1-VM and go to a website to test the network.
Inside L1-VM, accessing the internet
Installing Hyper-V on the Virtual Machine’s First Level
So far, you’ve constructed the layered virtualization setup’s soon-to-be Hyper-V host VM. The ultimate test, however, is to install Hyper-V inside the L1-VM and establish a second-level (guest) VM.
The operating system used by L1-VM will determine how Hyper-V is installed. Hyper-V for Windows 10 or Hyper-V for Windows Server are the two options. Hyper-V is installed on Windows Server 2016 in this scenario.
To install Hyper-V on L1-VM, go to the L1-VM console and do the following:
1. Run PowerShell as an administrator.
2. To install Hyper-V, use the command below in PowerShell. The -IncludeManagementTools setting adds Hyper-V management tools like the Hyper-V Manager and the Hyper-V PowerShell module to the installation. After the installation, the -Restart argument reboots L1-VM.
-IncludeManagementTools -Restart -Install-WindowsFeature Hyper-V
As illustrated below, you’ll get an install progress indication. Wait for the installation to complete, and L1-VM should restart on its own.
Hyper-VM on L1-VM installation
When L1-VM has restarted, launch the Hyper-V Manager on L1-VM. To do so, click Start —> Windows Administrative Tools —> Hyper-V Manager.
Hyper-V Manager is launched. on L1-VM
Congratulations! You’ve now successfully deployed Hyper-V in a Hyper-V guest VM!
Inside L1-VM, the Hyper-V Manager window
You’ve now successfully enabled layered virtualization in Hyper-V, and you can proceed to construct and set up your second-level VM (dubbed L2-VM) by using the identical procedures you used to create L1-VM.
Nested virtualization is used by Hyper-V guests.
Conclusion
This article walked you through the process of configuring layered virtualization in Hyper-V step by step. You may host a guest VM within another guest VM using nested virtualization, which is suitable for testing, lab environments, or imitating a production environment.
What are your thoughts on layered virtualization in Hyper-V? Is this something you’d use in your day-to-day work? Or do you believe there are better options?
Hyper-V is a technology that allows users to create virtual machines on their computer. This article will show you how to set up Hyper-V on your Windows PC. Reference: hyper-v windows 11.
Frequently Asked Questions
Related Tags
- install hyper-v
- enable hyper-v windows 10
- what is hyper-v
- hyper-v download
- how do you set up a virtual machine on windows 10