• 12 hours
  • Medium

Free online content available in this course.

course.header.alt.is_video

course.header.alt.is_certifying

Got it!

Last updated on 6/1/22

Virtualize Your Servers Using Hyper-V

Virtualization is a helpful and widely used technology that mimics physical hardware to create virtual infrastructure.

There are several different virtualization platforms available. While each product will have its own individual set of features, they all provide the same basic functionality - allowing you to create and access virtual infrastructure.

Microsoft’s Hyper-V is no different. You’ll learn all about it in this chapter!

Discover the Differences Between Hyper-V Versions

Microsoft offers different versions of Hyper-V based on the different Windows Server editions. We currently have the Windows Standard and Datacenter editions. The following table shows the major differences between these editions when it comes to Hyper-V:

 

Windows Server 2019 Standard Edition License

Windows Server 2019 Datacenter Edition License

Processor

2

2

Number of cores

16

16

Number of VMs

2

unlimited

Price in USD

$882

$6,155

To summarize the table and the operation:

  • Windows Standard: one host license and two VM licenses.

  • Windows Datacenter: one host license and unlimited VM licenses.

By purchasing a Windows Datacenter license, you’ll no longer have to worry about purchasing licenses for your virtual machines!

Understand Hyper-V

Now that you know a bit about Hyper-V let’s install this Windows Server role. For now, we’ll stick with the GUI. You may run into a specific issue when installing this role, especially on a virtual machine. When you add the role, you should get a validation error message regarding virtualization capabilities: 

Validation error for the Hyper-V role
Validation error for the Hyper-V role

You have three options:

  • Change hypervisor. VMware Workstation allows nested virtualization, which is required to run Hyper-V within a virtual machine - VirtualBox does not.

  • Switch to a 32-bit OS. VirtualBox allows these capabilities in 32-bit mode. 

  • Switch to a physical machine for Windows 2019 Server, which has a recent processor capable of offering these virtualization features. 

Once you’ve chosen based on your particular requirements and you’ve installed the role, you’ll have access to Hyper-V Manager, a new administration tool.

Like all other Microsoft tools, the view is divided into three panels:

  • The first one, on the left, shows the server. The list of available virtual machines is further down.

  • The second, in the middle, details the contents of the selection made on the left-hand panel by displaying the list of virtual machines or features of one virtual machine in particular.

  • Finally, the last one, on the right, lists possible actions depending on the selection made in the first panel. If you’ve selected the name of your server, this panel will let you create a new virtual machine, manage virtual commutation, or even manage disk space for your virtual machine storage.

Hyper-V Manager
Hyper-V Manager

When working with virtualization, you must understand the mechanism at play. Stop seeing the computer you’re working on as a classic computer (whether it’s a server or not), but rather as a server-hosting zone with complete network management, storage management, and CPU and RAM resources. This point is essential if you’re installing this in production.

Again, let’s imagine you’re an administrator or IT technician at Gift Ltd.

Your manager gives you a $5,000 budget to install three servers: a file server, an identity server, and a web server. The only way to stay within budget (apart from cloud systems) is virtualization on Windows Server Standard on an entry-level machine. You’ll find a good number of offers from server builders such as Dell, HP, Fujitsu, Lenovo, etc.

Once you’ve acquired your server with its Windows Server 2019 Standard license, you’ll have a license for the physical machine. Next, you’ll install the Hyper-V role, then create a virtual machine to store an AD and a virtual machine to host your file server and your web server.

How will my virtual machines access the network?

Good question. For this price, it’s unlikely you’ll have lots of network adapters. So let’s work on the notion that you’ve only got one adapter.

In this case, Hyper-V (like all hypervisors) has capabilities for virtualizing the network adapter. You can create a virtual switch connected to the physical network adapter through this. This virtual switch will provide you with some network ports available for virtual machines.

To give you an idea, here’s a diagram of your network before and after activating the Hyper-V role:

Physical server with and without the Hyper-V role
Physical server with and without the Hyper-V role

So your physical server will provide your virtual machines with a virtual switch and share the bandwidth of its network adapter.

Now that you’ve grasped the idea, let’s configure this virtual switch. Go ahead and click on Virtual Switch Manager in the Action menu, having selected your server in the left-hand panel.

Virtual switch manager
Virtual switch manager

Here you’ll find the names of your virtual switches and how they operate (type of network). There are three different modes:

  1. An external network that gives you access to a physical network interface. It is also possible not to share the network adapter with the physical server to guarantee better bandwidth to virtual machines. 

  2. An internal network that creates a switch not connected to the external physical network. This mode allows for a switch connected to a host server (your physical server) but not linked outside the network. This can be useful when configuring your virtual machine before networking it.

  3. A private network. Virtual machines can’t access the host or the external network in this mode! It links two virtual machines to set up a firewall which has an interface on an external network and an interface on this private network.

Once again, you decide between these different modes according to your virtual machines’ network requirements.

Create Your First Virtual Machine with Hyper-V

You’ve set your network preferences and chosen a virtual switch with access to the external network. Now all you need to do is create a virtual machine.

Follow these eight steps:

  1. Name the virtual machine.

  2. Assign storage space to the machine.

  3. Select the generation of the machine.

  4. Allocate a dedicated amount of memory to the machine.

  5. Configure the machine’s network connection.

  6. Configure your virtual disk.

  7. Define operating system installation settings.

  8. Configure processor allocation.

Without further ado, select your server in the left-hand panel of your Hyper-V Manager, click Action (on the right), and select New. It is possible to create a virtual machine with the Quick Create Wizard, but for your first one, it’s a good idea to go into the details to understand what’s going on.

Select New and then Virtual Machine, and name your machine. Remember that naming is a crucial stage for identifying your server, and the same goes for a virtual server, e.g., SRVHYVNY01 (type, role, location, and number).

You have the option of changing where files are stored.

You should take a few precautions when it comes to storage space:

  1. Select a space that is big enough and quick enough. Consider the size of your future operating system and the quantity of data you’ll need to manage (a Windows OS will need 20 to 30 GB). Therefore, a 40 GB disk (providing additional wiggle room) is a good option.

  2. Commercial hard disks are not made for this type of use. If you’re using physical machines that are not server-oriented, your performance will be terrible, and this happens quite often. A professional hard disk made specifically for servers can cost five to ten times more than your everyday hard disk.

  3. Publicly-available SSD hard disks might be cheap, but their lifespan will lessen if used in this way. Again, professional SSDs cost much more but can handle this use.

Ideally, you’ll want a 10,000-RPM hard disk, maybe even 15,000, or an SSD with a very low error rate and a read/write data volume well above capacity.

Once you have considered all of this, you need to select a generation. The generation is linked to the operating system you install on the virtual machine. Make sure you get this right – you can’t change it later without deleting the whole virtual machine.

As you’ve used Gift Ltd.’s account to buy a recent server that uses Windows 2019, you can run Generation 2.

Next, you need to allocate some RAM. Again, keep your virtual machine and physical machine in mind. Your physical machine requires enough remaining memory to operate, so start with a minimum quantity, such as 2 GB. Increase it if you see things slowing down or you regularly use the swap space. 

Finally, select the network (a port on the virtual switch you created before) and the location of your virtual machine’s system hard disk. The hard-disk size will not be directly provisioned – you can make more space appear on your virtual machine than your physical server has. Think back to the first chapters of this course and consider this value carefully.

Next, decide how you will install the virtual machine’s operating system. It’s better to declare your installation media at this point so that a DVD drive will be created when booting your virtual machine.

First virtual machine on Hyper-V
First virtual machine on Hyper-V

Before firing up your machine, you must manage and configure the allocated processor percentage.

First, select your virtual machine and navigate to the Action menu. Then go to the part under your virtual machine’s name and select Settings. You’ll arrive at the different settings for your machine:

  • BIOS

  • Security

  • Memory

  • Processor

  • Storage controllers

  • Network adapter

You’ll also see management options, such as:

  • Name

  • Integration Services

  • Checkpoint File Location

  • Smart Paging File Location

  • Automatic Start and Stop Actions

Virtual machine settings
Virtual machine settings

Click on the Processor heading. As you’ll see, Hyper-V will allocate one virtual processor to your machine by default and allow it to use up to 100% of your physical processor. You can increase these settings to give your virtual machine more power depending on the number of processors, cores, and threads in your physical server.

However, in the Gift Ltd. example, you’ve purchased a server with lots of physical cores. Therefore,  it’s a good idea to move onto two processors for each of your virtual machines to get better processing time for file access requests (for the file server VM) and authentication requests (for the AD VM).

After you’ve made any changes, you can boot your virtual machine by right-clicking on the machine’s name. You can now connect to it by right-clicking again and selecting Connect.

Once your virtual machine has booted, your machine will behave like a physical server.

So over to you to install your operating system and the different roles required for your network to work as it should!

Let’s Recap!

  • Hyper-V is the Microsoft hypervisor. It is integrated with Windows Server and Windows 10.

  • A Windows Server 2019 Standard license lets you have two virtual machines on Windows Server in addition to the physical server.

  • Virtualization lets you optimize your physical server’s processor, memory, drive, and network resources by spreading these resources between different virtual machines.

  • Once created, a Hyper-V virtual machine behaves like a physical server.

The last two chapters about Hyper-V and PowerShell have prepared you for a smooth transition to the penultimate chapter of this course: the cloud. Using APIs, cloud lets you configure a complete architecture in just a few lines of script. Let’s go!

Example of certificate of achievement
Example of certificate of achievement