carloscastilla - Fotolia


Build a Hyper-V home lab in Windows Server 2019

Production servers aren't the place to experiment with Microsoft's Hyper-V technology. This guide helps you build a lab tailored for a nested virtualization environment.

In IT, theoretical knowledge only gets you so far. One way to improve your skills is with hands-on experience from...

building and using a Hyper-V home lab.

You can build an inexpensive Hyper-V virtual lab using Windows Server 2019 and Hyper-V that gives you nearly limitless opportunities for learning and experimentation. With a single, moderately powered computer, you can use nested virtualization to create a two-node failover cluster hosting highly available Hyper-V VMs. A lab built on Microsoft's virtualization technologies will help you with your efforts in areas of certification and working with the new Windows Server features.

There are a few reasons why using nested virtualization is a better choice compared to deploying multiple VMs in Windows 10 Hyper-V in a failover cluster:

  • Failover clustering requires an Active Directory (AD) domain and at least two nodes.
  • Failover clustering only runs on Windows Server, so all participating nodes need to run Windows Server, not Windows 10.
  • We don't want to overly modify our Windows 10 system's environment. The purpose of a lab is to leave it as simple as possible.

The following graphic shows the topology diagram for our Hyper-V home lab.

Hyper-V virtual lab environment
The Hyper-V virtual lab environment you will build with Windows 10 and Windows Server 2019 to make a cluster hosting highly available VMs

As a longtime technical trainer, I've discovered that students learn most efficiently when they are challenged to build something that matters. To that point, I will only provide high-level configuration steps and documentation links. As part of this learning process, it's up to you to put the pieces together through trial and error.

What Hyper-V home lab hardware should you get?

There are a few reasons why using nested virtualization is a better choice compared to deploying multiple VMs in Windows 10 Hyper-V in a failover cluster.

You just need one physical computer to serve as your Hyper-V virtualization host. I suggest the machine have one of the following CPUs, all of which are optimized for virtualized workloads: Intel Xeon, Intel Core i7 or AMD Ryzen 5 2600.

I recommend 32 GB of RAM if you can afford it. The physical host should run Windows 10 Enterprise, Pro or Education edition; you need one of these stock-keeping units (SKUs) to enable Hyper-V.

Enable Hyper-V on your Windows 10 host

Open an elevated PowerShell command prompt console on your Windows 10 computer, and run the following command to enable Hyper-V. (You'll need to restart after installation completes.)

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

You can also enable Hyper-V in the Windows features control panel.

enable Hyper-V in Windows 10
To install the Hyper-V feature in Windows 10 Pro, go to the features control panel, and enable all the Hyper-V components.

You also need a free 180-day evaluation copy of Windows Server 2019 from Microsoft Evaluation Center. Download the ISO file that you will attach to the virtual optical disk drive on your VM.

Configure Hyper-V on your hardware host

Start Hyper-V Manager on your Windows 10 machine to set up virtual networking. You will create an internal switch so the Windows 10 Hyper-V host can communicate with the Windows Server VM you'll create momentarily.

If you've never configured Hyper-V networking, these tutorial links will help you get it set up:

  1. Hyper-V virtual networks
  2. Hyper-V virtual switches

Next, use the Windows Server 2019 ISO image file to deploy your VM. Here are some guidelines:

  • Enable dynamic memory to conserve RAM.
  • Give the VM as much RAM as you can spare. If your physical host has 32 GB RAM, then I would give 12 to 16 GB to the VM.
  • Power off the VM when the lab is not in use to give your hardware host its resource back.
VM setup in Hyper-V Manager
Configure the VM with Hyper-V Manager.

The following tutorial links will help you use Hyper-V Manager to create the VM:

  1. Create a VM
  2. Hyper-V Dynamic Memory
  3. Remotely manage Hyper-V VMs

In case you need it for troubleshooting purposes, you can find the Hyper-V configuration files and other metadata in the C:\ProgramData\Microsoft\windows\Hyper-V default path.

Set up nested virtualization on your VM

Nested virtualization is an optional feature used on a Hyper-V host to run guest VMs that can, in turn, become virtual Hyper-V hosts.

Open another elevated PowerShell console on your Windows 10 hardware host, and run the following command, substituting the name of your initial VM for the <vmname> placeholder:

Set-VMProcessor -VMName <vmname> -ExposeVirtualizationExtensions $true -Force

Now, we can sign into our first VM and make it a Hyper-V host.

Connect to your VM and prepare its environment

Use the Hyper-V Virtual Machine Connection (VMConnect) utility to establish a Remote Desktop Protocol (RDP) session to your new Windows Server 2019 VM. Next, you have several tasks to complete:

  • Install AD Domain Services (DS), and make the VM the first domain controller of a new forest.
  • Install the Hyper-V server role.
  • Create an internal Hyper-V switch on the server.
  • Deploy two Windows Server 2019 VMs.
  • Use Hyper-V VMConnect or another method to connect to each of the two nested VMs, and join them to the new AD domain.

The following links will help you complete those configuration jobs:

  1. Install a new Active Directory forest
  2. Join a Windows Server system to a domain
  3. Manage VMs with Windows Admin Center

Deploy a failover cluster

The idea behind the Windows Server failover clustering feature is you have two or more systems, called nodes, connected to centralized, shared storage. With this configuration, you can store database files or VMs on the shared storage and configure each cluster node as a database or Hyper-V server, respectively.

This combination of redundant server nodes and shared storage provides high availability. The steps required to build a failover cluster to host highly available VMs takes us far beyond the scope of this tutorial. There's plenty of help on this topic from Microsoft's documentation that will walk you through the remainder of the setup, but I'll leave you with some guidance.

First, expect to spend most of your time setting up the cluster as opposed to actually using it. Second, I recommend using Storage Spaces Direct for the shared storage because it's free and included with Windows Server.

Next Steps

Which is better for Hyper-V management: SCVMM or Hyper-V Manager?

What skills do Hyper-V administrators need?

How do the high availability features in Hyper-V and vSphere compare?

Dig Deeper on Microsoft messaging and collaboration