Microsoft Hyper-V, known as Windows Server Virtualization, is a native (bare) hypervisor. It can create virtual machines on x86-64 systems running Windows OS, starting with Windows 8. Hyper-V supersedes Windows Virtual PC as the hardware virtualization component of the client editions of Windows NT.
Let's look at how to add an IPv4 address range as a possible live migration network on the local Hyper-V host by using a subnet mask: 1. Open a PowerShell prompt and type the command shown in the following screenshot. Traditionally, this isolation was enforced using VLANs with a segregated IP address range and 802.1q Tag or VLAN ID. But with HNV, isolation is enforced using either NVGRE or VXLAN encapsulation to create overlay networks with the possibility of overlapping IP subnets between customers or tenants.
- Virtualization 2.0 Tutorial
- Virtualization 2.0 Useful Resources
- Selected Reading
In this chapter, we will discuss Microsoft Hyper-V along with its various modules.
Installing Hyper-V in Windows Server 2012
Microsoft Hyper-V, known as Windows Server Virtualization, is a native (bare) hypervisor. It can create virtual machines on x86-64 systems running Windows OS, starting with Windows 8. Hyper-V supersedes Windows Virtual PC as the hardware virtualization component of the client editions of Windows NT. A server computer running Hyper-V can be configured to expose individual virtual machines to one or more networks.
Hyper-V was first released alongside Windows Server 2008 and Windows 7 and has been available without charge for all the Windows Server versions and some client operating systems since that time.
Let us see how to install a Hyper-V role in a Windows Server 2012 by following the steps given below.
Step 1 − To Install Hyper-V role go to “Server Manager” → Manage → Add Roles and Features.
Step 2 − Click on “Next”.
Step 3 − Select “Role-based or feature-based installation” option → click on “Next”.
Step 4 − We will locally install the Hyper-V role as such “Select a server from the server pool” → click “Next”.
Step 5 − From the Roles lists, check the “Hyper-V” Server role → click on Add Features on the popup window → click “Next”.
Step 6 − Click “Next”.
Step 7 − Choose your server’s physical network adapters that will take part in the virtualization and responsible for network switching → click on “Next”.
Step 8 − Under Migration, leave the default settings → click on “Next”.
Step 9 − Choose the path where you want to save the file → click on “Next”.
Step 10 − Click “Install” and wait for the installation bar to finish.
Installing Hyper-V in a windows 10 workstation
To install it in Windows 7, 8, 10 versions, you have to check if your computer supports virtualization. Following are the basic requirements −
- Windows 10 Pro or Enterprise 64-bit Operating System.
- A 64-bit processor with Second Level Address Translation (SLAT).
- 4GB system RAM at minimum.
- BIOS-level Hardware Virtualization support.
In my case, we have a laptop HP Probook 450 G3, which supports it.
Before continuing with the installation, follow the steps given below.
Step 1 − Ensure that hardware virtualization support is turned on in the BIOS settings as shown below −
Step 2 − Type in the search bar “turn windows features on or off” and click on that feature as shown below.
Step 3 − Select and enable Hyper-V.
Creating a Virtual Machine with Hyper-V
In this section, we will learn how to create a virtual machine. To begin with, we have to open the Hyper-V manager and then follow the steps given below.
Step 1 − Go to “Server Manager” → Click on “Hyper-V Manager”.
Step 2 − Click “New” on the left Panel or on the “Actions” button.
Step 3 − Double-click on “Virtual Machine…”
Step 4 − A new table will open → Type Name of your new machine → click “Next”.
Step 5 − A new table will be opened where you have to allocate the memory. Keep in mind you cannot choose more memory than you have physically.
Step 6 − In the “Connection” drop down box, choose your physical network adaptor → click on “Next”.
Step 7 − Now it is time to create a Virtual Hard disk, if you already have one, choose the second option.
Step 8 − Select the Image of ISO that has to be installed → click on “Finish”.
Step 9 − After clicking on finish, you would get the following message as shown in the screenshot below.
Step 10 − To connect to the Virtual machine, Right Click on the created machine → click on “Connect…”
Step 11 − After that, installation of your ISO will continue.
Setting up Networking with Hyper-V
The Hyper-V vSwitch is a software, layer-2 Ethernet network-traffic switch. It allows administrators to connect VMs to either physical or virtual networks. It is available by default within the Hyper-V Manager installation and contains extended capabilities for security and resource tracking.
If you attempt to create a VM right after the set-up process, you will not be able to connect it to a network.
To set up a network environment, you will need to select the Virtual Switch Manager in the right hand side panel of Hyper-V Manager as shown in the screenshot below.
The Virtual Switch Manager helps configure the vSwitch and the Global Network Settings, which simply lets you change the default ‘MAC Address Range’, if you see any reason for that.
Creation of the virtual switch is easy and there are three vSwitch types available, which are described below −
External vSwitch will link a physical NIC of the Hyper-V host with a virtual one and then give your VMs access outside of the host. This means that your physical network and internet (if your physical network is connected to internet).
Internal vSwitch should be used for building an independent virtual network, when you need to connect VMs to each other and to a hypervisor as well.
Private vSwitch will create a virtual network where all connected VMs will see each other, but not the Hyper-V host. This will completely isolate the VMs in that sandbox.
Here, we have selected “External” and then “Create Virtual Switch”. The table with the setting of the vSwitch will be open where we will fill the fields as shown below
Name − is the name that we will put to identify the vSwitch.
Notes − is the description for us, generally, we put friendly descriptions to be understood.
Connection Type − is external as explained earlier and selects a physical network card on my server.
Once all this is entered, Click on “OK”.
Allocating Processors & Memory to a VM using Hyper-V
In this section, we will see the task of allocating CPU, Memory and Disk Resources to the virtual machines that are running on a server. The key to allocating CPU or any other type of resource in Hyper-V is to remember that everything is relative.
For example, Microsoft has released some guidelines for Virtualizing Exchange Server. One of the things that was listed was that the overall system requirements for Exchange Server are identical whether Exchange is being run on a virtual machine or on a dedicated server.
To allocate one of the features mentioned above, we need to click on the “Settings…” tab in the right hand side panel.
To allocate more memory to the selected virtual machine, click on the “Memory” tab on the left hand side of the screen. You will also have “Startup RAM”, where you can allocate as much ram as you have physically to a VM machine → Click on “Ok”.
To allocate more processors, click on the “Processor” tab on the left hand side of the panel. Then you can enter the number of virtual processors for your machine.
If you need to expand, compress the capacity of the virtual hard disk. Click on the “IDE controller 0” on the left hand side panel → click on “Edit”.
Once all the above changes are done, Click on “Next”.
Select one of the options based on your need (all of them have their respective descriptions) and then click on “Next”.
Click on “Finish” and wait for the process to finish.
Using Checkpoints in Hyper-V
Checkpoints in Hyper-V are called snapshots and they help us to revert the machine in a desired state that we had in the past.
To create a checkpoint we should follow the steps given below.
Step 1 − Select the VM by clicking on it. On the left hand side panel, click on “Checkpoint”.
Step 2 − The following checkpoint will be created with the respective date and time in the main Hyper-V manager console.
In this post I’m going to talk about the MAC Address Pools in Hyper-V / VMM and the actual way they work.
It seems easy to setup and never look at it again but this can cause some serious issues.
There are many threads on technet forums about virtual machines changing MAC addresses and especially Linux virtual machines losing network connection.
Lets start at the beginning.
In the Hyper-V Manager you can set a specific range what addresses are allocated to the VM’s.
You can see/edit the range under the “Virtual Switch Manager”.
So every new VM gets a MAC address in this range specified on the Hyper-V host.
You can view the MAC of a VM under “Settings > Network Adapter > Advanced Features”
As you can see the allocated MAC is within the specified MAC range.
You could set your own MAC here, using the static MAC option.
But what happens when you have more than 1 host??
Hyper-V has an algorithm to deal with duplicate MAC addresses on a single host, but not across multiple hosts.
So, if you not take care it is possible to accidentally deploy hosts with duplicate MAC address pools.
Make sure you do not use the same range on different Hyper-V hosts!!
Once the MAC address pool is created when the Hyper-V role is installed, imaging the host will cause each Hyper-V server deployed using the image to have the same MAC address pool. Even if you sysprep the host before you image it, the registry values are not reset.
MAC Address Regeneration
When Live Migrating VM’s to a different host there’s no problem and the VM will keep the same MAC.
If there’s a different MAC range allocated on the new host the MAC changes when:
– VM is turned on from off state
– VM is restored from save state (Quick migration!)
– Antoher VM uses the same MAC.
If you’ve set a static MAC, the MAC moves between hosts.
Microsoft Hyper-v Address Range Chart
Linux
Unlike Windows, Linux VM’s (Redhat, Centos, Ubuntu etc.) have the MAC address hardcoded in configuration files.
When the above situation occurs the VM will get a new MAC and loses network connectivity.
You will need to edit the network cfg’s and enter the new MAC to get the VM online.
Make sure you use static MAC addresses in this situation!
VMM – Virtual Machine Manager
In VMM a default MAC Address Pool is created with range 00-1D-D8-B7-1C-00 to 00-1D-D8-F4-1F-FF (3998720 addresses).
VM’s deployed with VMM can make use of this default pool when the NIC settings are set right.
Dynamic = Get your MAC from the Hyper-V host
Static = Get your MAC from the VMM MAC address pool
Select static (also in templates and hardware profiles!) to make use of the default MAC Address Pool and overcome any MAC problems.
Once you allocated a MAC from the MAC pool the MAC stays static on all your Hyper-V hosts.
When you select “Static” and leave the value “00:00:00:00:00:00” it will allocate a MAC from the MAC pool for you, you dont have to make up one 😉
Microsoft Hyper-v Address Range Calculator
When deploying a virtual machine using the Hyper-V Manager on a host managed by SCVMM, the virtual machine will not use the SCVMM static MAC address pool, but will use the locally defined dynamic MAC address pool on the Hyper-V host when selecting “Dynamic”.
When selecting static here, you will need to make up a MAC.