Hyper-V Cluster Setup 2 of 3: Hyper-V role, shared storage, virtual switches
Brandon Lee, posted on April 12, 2017
In the last post, we talked about the initial host configuration, planning our networks for the environment as well as creating storage targets. Let’s take a look at installing the Hyper-V role on our hosts, setting up our shared storage on both hosts, and creating our virtual switches.
Installing Hyper-V role and setting up storage
After we have both servers provisioned with a basic configuration, we can install the Hyper-V role and also provision our storage. Once we have these components configured, we can create our Windows Cluster of the two Hyper-V role enabled hosts.
To install the Hyper-V role service, we run the following command in a PowerShell command prompt:
- Install-WindowsFeature -Name Hyper-V -IncludeAllSubFeature -IncludeManagementTools -Restart
Adding the iSCSI portal address
Before adding our iSCSI portal address, we need to configure and start the Microsoft iSCSI service. We set the service to automatic and then start the service.
- Set-Service -Name msiscsi -StartupType Automatic
- Start-Service msiscsi
To add our target iSCSI portal address, we can again utilize PowerShell and add our iSCSI portal address provisioned:
- New-iscsitargetportal -targetportaladdress 〈IP address〉
Next, we connect the specific iSCSI targets that we created on our FreeNas appliance. Below are examples of what I used in adding the FreeNas targets to the Hyper-V hosts provisioned for the cluster.
- Connect-IscsiTarget -nodeaddress iqn.2005-10.org.freenas.ctl:quorum -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 10.0.0.70 -TargetPortalAddress 10.0.0.1
- Connect-IscsiTarget -nodeaddress iqn.2005-10.org.freenas.ctl:hvvol1 -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 10.0.0.70 -TargetPortalAddress 10.0.0.1
You can verify and see the targets that are added by running the Get-iSCSItarget command:
Also, we can use the get-disk command to show disk information and make sure the volumes are showing up as online and healthy.
Setting up our Virtual Switches
We can use either PowerShell or the Hyper-V GUI management console to set up our virtual switches for Hyper-V. Setup your virtual switch names identically between both hosts as we will want to make sure the virtual switches match especially when performing a live migration.
In this post we looked at installing the Hyper-V role on our prospective hosts, setting up our shared storage on both hosts, and creating our virtual switches. Next, we will take a look at creating the Windows Failover Cluster for our Hyper-V hosts, creating the clustered shared volume, and then creating a highly available VM.