Hyper-V is a built-in part of Windows Server 2008 and later. However, the Hyper-V role is not active by default, therefore you need to enable it manually. The process of installing the Hyper-V role is extremely easy and intuitive. There are three ways through which you can enable Hyper-V in your Windows system: Windows System Settings, PowerShell Command Line Interface (CLI), or Deployment Image Servicing and Management (DISM). The process of installing Hyper-V using Windows Control Panel, which is the most popular approach, will be demonstrated below.
- Type Settings in the search box situated on the taskbar below and press ENTER. The Settings app will open.
- Click the Apps icon.
- Select Programs and Features on the right under the Related Settings section.
- Select Turn Windows Features on or off on the left.
- In the Windows Features dialog box, select Hyper-V and click OK.
After the process of installing Hyper-V is complete, click Restart Now to implement all the required changes or click Don’t Restart to postpone the restart of your computer.
Creating a Virtual Switch for Hyper-V Virtual Machines
After installing Hyper-V on your computer, you may want to create new VMs in order to start building virtual environment from scratch. However, prior to that, you should first consider creating a virtual switch, which can be used to ensure communication between VMs. Moreover, a virtual switch enables the connection of VMs to both physical and virtual networks. Also, virtual switches can be used for migrating VMs from one physical host to another. For this purpose, ensure that the source host and the target host have virtual switches with the matching names.
You can create a virtual switch by using Hyper-V Manager, which can be done in the following way:
1. Open Hyper-V Manager, select the Hyper-V host computer name.
2. Select the Action option above. In the drop-down menu, find Virtual Switch Manager and click on it.
3. Virtual Switch Manager will open, where you can choose the type of virtual switch that you need. There are three types of virtual switches available:
- External switch helps to create a virtual switch which provides VMs with the access to a physical network by binding to the physical network adapter.
- Internal switch helps to create a virtual switch which is only available to the VMs that run on this physical computer, but it does not provide access to a physical network connection.
- Private switch helps to create a virtual switch which can be used only by the VMs that run on the same physical computer. A private network allows to create an isolated networking environment which cannot be accessed externally.
4. Select Create Virtual Switch.
5. Set up Virtual Switch Properties. Here, you can insert the name of the new virtual switch and type some additional information in the Notes section.
6. Configure the connection type by choosing the network type you want the virtual switch to connect to (external, internal, private).
If External, choose the type of the network adapter that you want to use. After that, check the box below if you want to allow management operating system to share this network adapter.
Moreover, if you want to isolate the management Hyper-V host operating system (OS) or other VMs that share the same virtual switch from the network traffic and identify the local area network (LAN) that will be used for network communications, select Enable virtual LAN identification for management operating system. This feature is available for external and internal networks. You can manually set up VLAN ID, which will then be associated with a certain VLAN and used for future network communications.
7. Click OK. The following dialogue window will appear.
8. Click Yes if you want to apply the networking changes.
After that, the virtual switch will be created, meaning that your virtual environment can now use its own virtual network to facilitate VM networking.
How to Create Hyper-V Virtual Machine
There are three common ways through which you can create Hyper-V virtual machine: Hyper-V Manager, PowerShell, and Hyper-V Quick Create. All of them will be discussed in detail below.
How to Create Hyper-V Virtual Machine Using Hyper-V Manager
1. Type Hyper-V Manager in the search box situated on the taskbar below and press ENTER. Hyper-V Manager will open.
2. On the left, select the Actions section, find New, and click Virtual Machine.
3. New Virtual Machine Wizard will open, presenting the set of VM options that you need to configure. They include: Before You Begin, Specify Name and Location, Specify Generation, Assign Memory, Configure Networking, Connect Virtual Hard Disk, and Summary.
4. The Before You Begin section provides a short overview of what this wizard can do and how to use it. Read it and check the box Do not show this page again below if you want to skip this information in the future.
5. In the next section, you can configure the VM name and location. Ensure that the VM name is unique and allows you to easily identify the required VM. As for the VM location, you can either leave the default one, or you can create a folder and assign a new location of your choice. For this purpose, check the box below and click Browse.
6. In the Generation section, you can choose the generation of the VM. The choice between Generation 1 and Generation 2 is mainly dictated by the guest OS that you want to install. Generation 1 VMs support 32-bit and 64-bit guest OSes and BIOS-based architecture. Also, they provide functionality of the earlier versions of Hyper-V. Generation 2 VMs, on the other hand, support 64-bit Windows OSes and the latest versions of Linux and FreeBSD OSes and provide advanced virtualization features, such as Secure Boot. Take all aspects into account when choosing between the two generation types because you can’t change the VM generation after the VM has been created.
7. In the following section, you must specify the amount of memory (from 32 MB up to 12,582,912 MB) which will be assigned to the VM. The future performance of the VM will largely depend on the amount of allocated memory. Moreover, you can choose to use Dynamic Memory for this VM by checking the box below. This feature allows you to take a part of the memory available on a physical host and assign resources to the VM which needs it most.
8. The next step allows you to choose a virtual network that will be used for connecting the VM to the network. For this purpose, select a virtual switch that you have created earlier. If you don’t have a virtual switch, only the Not Connected option will be provided, meaning that your VM will be left without network access.
9. Next, configure the virtual hard disk requirements. In this section, you can create a new virtual hard disk, which requires specifying its name, location, and size. Or, you can use an existing virtual hard disk (of the VHD or VHDX format). Another option is to skip this step and attach a virtual hard disk later.
If you have decided to select Create a Virtual Hard Disk, the Installation Options section will appear where you can specify configurations right away or postpone it for later. Here, you can install a guest OS by choosing the ISO file. In this case, you can select one of the following variants:
- Install an operating system later
- Install an operating system from a bootable CD/DVD-ROM
- Install an operating system from a bootable floppy disk
- Install an operating system from a network-based installation server
Select one of the options and click Next.
10. The last section is Summary, which provides a short description of this VM. Look through it once again and check to make sure everything is correct. If so, click Finish to create the VM and close the wizard.