How to Install Hyper-V and Create a Private Virtual Switch

Bryan Renzy
7 min readMay 25, 2021
source: cybrary.it

What are we doing?

This lab consists of one exercise guiding us through the installation and configuration of a hypervisor, called Hyper-V, to enable a virtual switch.

Why would we want to do this?

Hypervisors help us create virtual machines (VMs). Without them, it would be rather difficult to create a VM and utilize its OS on one of our hardware devices. Think of the hypervisor as an emulator for our virtual machines, where it’s able to utilize our hardware’s resources in order to use the VMs.

My favorite analogy for hypervisors is to see them like the universe. The hypervisor is the universe, the virtual machines are the galaxies, and our docker containers and apps act as the planets. Without our universe, galaxies couldn’t be created, and our planets would struggle to form a proper ecosystem.

There are two types of hypervisors: Type 1 (bare-metal) and Type 2 (hosted)

Source: Scsami

The most commonly deployed type of hypervisor is the bare-metal (type 1) hypervisor, where virtualization software is installed directly on the hardware, as if it were the operating system. This means that our hardware running as a bare metal hypervisor can only be used for virtualization purposes and nothing more. Bare metal hypervisors are extremely secure because they run directly on the physical hardware without any underlying OS, which means they’re protected from the vulnerabilities that are often native to operating systems. So, even if our hardware gets infected, our VMs should still be safe from the infection. In addition, they generally perform better and more efficiently than hosted hypervisors. For these reasons, most enterprise companies choose bare-metal hypervisors for data center computing needs.¹

Most common Type 1 Hypervisors include:

Citrix Hypervisor, VMware vSphere, Red Hat Enterprise Virtualization, KVM, and Microsoft Hyper-V

While bare-metal hypervisors run directly on the hardware, hosted (type 2) hypervisors run within the operating system of our hardware device (the host machine). Although hosted hypervisors run within the OS, additional (and different) operating systems can be installed on top of the hypervisor. The downside of hosted hypervisors is that latency is higher than bare-metal hypervisors. This is because communication between the hardware and the hypervisor must pass through the extra layer of the OS. Hosted hypervisors are sometimes known as client hypervisors because they are most often used with end users and software testing, where higher latency is less of a concern.¹

Most common Type 2 Hypervisors include:

Oracle’s VirtualBox, VMware Workstation Pro, and VMware Fusion

Who would use this?

IT managers and those managing their small businesses would use hypervisors as a way to utilize several advantages, such as:

  • Speed: Hypervisors allow virtual machines to be created instantly, unlike having to purchase and install bare-metal servers. This makes it easier to provision resources.
  • Efficiency: It is more cost- and energy-efficient to run several virtual machines on one physical machine than to run multiple underutilized physical machines for the same task.
  • Flexibility: Bare-metal hypervisors allow operating systems and their associated applications to run on a variety of hardware types because the hypervisor separates the OS from the underlying hardware, so the software no longer relies on specific hardware devices or drivers.
  • Portability: Hypervisors allow multiple operating systems to reside on the same physical server (host machine). Because the virtual machines that the hypervisor runs are independent from the physical machine, they are portable. IT teams can shift workloads and allocate networking, memory, storage and processing resources across multiple servers as needed, moving from machine to machine or platform to platform. When an application needs more processing power, the virtualization software allows it to seamlessly access additional machines.¹

Thoughts?

With Type 1 hypervisors being as secure as they are, I’m fascinated with Microsoft’s Hyper-V Bounty Program, as the payouts are rather impressive (which can only confirm the difficulty in finding a vulnerability). Here’s the latest vulnerability reported so far:

Hyper-V Remote Code Execution Vulnerability -CVE-2020–17095

Vendor

Practice Labs

Lab

1.10 — Install Hyper-V

Lab Learning Outcomes

  • Exercise 1 — Enabling Hyper-V Feature

After completing this lab, we will be able to:

  • Install Hyper-V
  • Create a private virtual switch

CompTIA Network+ N10–007 Exam Objectives

N10–007–2.4: Explain the purposes of virtualization and network storage technologies:

  • Virtual networking components (Virtual switch, Hypervisor)
source: practice labs

Exercise 1

Enabling Hyper-V Feature

Hyper-V is a machine virtualization platform from Microsoft that enables us to install and run multiple 32-bit or 64-bit OS in parallel on the same machine. We can use Hyper-V to install and test virtual machines of various configurations without affecting the functionality of the physical machine and without interfering with the other virtual machines. This enables us to work on various OS’s without having to invest in computer hardware.²

After completing this exercise, we’ll be able to:

  • Install Hyper-V
  • Configure a virtual switch

Step 1: Connect to PLABSA01, and open the Windows PowerShell and input:

Install-WindowsFeature -Name Hyper-V -IncludeManagementTools 
>> -Restart

Step 2: Please wait while installation of Hyper-V feature is in progress. Once the Installation is completed, we should lose our connection to PLABSA01 since it should restart.

Note: Please wait for about 2 minutes before we reconnect to PLABSA01. This is to give the computer sufficient time to complete its restart after the installation of Hyper-V.

Step 4: Reconnect to our PLABSA01 device.

When signed in, minimize the Server Manager, click Start and find the Windows Administrative Tools folder. Click to expand the folder. Locate the Hyper-V Manager app.

Listing of the Hyper-V Manager app in the menu verifies successful installation.

Task 1 Complete!

Now we know how to install Hyper-V on a Windows device!

Task 2 — Create Hyper-V Virtual Network Switch

A virtual network switch is just as it sounds, a virtual switch. It’s a piece of software operating within the Hyper-V host that performs Ethernet frame switching functionality. Hyper-V provides virtual network adapters to its virtual machines, and those communicate directly with the virtual switch.³

Hyper-V supports three types of virtual networks:

External virtual networks — used to provide virtual machines with access to a physical network so they can communicate with externally located servers and clients.

Internal virtual networks — used to allow network communication between virtual machines on the same virtualization server, and between virtual machines and the management operating system.

Private virtual network — used to allow network communication between virtual machines on the same virtualization server. A private virtual network is not bound to a physical network adapter. This type of network is useful if we want to create an isolated network environment.

In this task, we’ll create a private virtual network switch.

Step 1: Click Hyper-V Manager in the Windows Administrative Tools window.

On the Hyper-V Manager window, locate PLABSA01 on the navigation pane at the left.

Right-click PLABSA01 and select Virtual Switch Manager

Step 2: The Virtual Switch Manager for PLABSA01 dialog box is displayed.

On the What type of virtual switch do we want to create section, select Private.

Click Create Virtual Switch.

Step 3: In the Virtual Switch Properties section, click within the Name field and replace its contents with the following:

Private Network 1

Verify Connection type is set to Private network.

Click Apply then OK.

Step 4: Once the switch is created, we are returned to the main Hyper-V Manager page. To view our virtual switch, click on the PLABSA01 device and then under the actions panel at the right, choose Virtual Switch Manager. The Virtual Switch Manager for PLABSA01 window appears. We can see the switch we created under the Virtual Switches heading.

We now officially have a virtual network switch on our Hyper-V host!

To get a more in-depth overview of Hyper-V and its utility, check out Eric Siron’s really useful article:

What is the Hyper-V Virtual Switch and How Does it Work?

Exercise 1 Complete!

--

--