Connect with us

Gadgets

How to Migrate VMware to Hyper-V (2): Prep Hyper-V Hosts

[ad_1]

In this part (2) of the Hyper-V to VMware migration, you will prepare your Hyper-V hosts. The tasks covered include installing and patching Windows Server 2022.

You’ll also install Hyper-V, Windows Clustering, and MPIO (optional) roles on each host. You will also connect the hosts to the storage and configure the disks required to configure the cluster. 

Finally, you will assign the host’s IP addresses, create Hyper-V virtual switches, and assign them IP addresses. 

Task 1: Meet the Windows Domain Requirement

All the configurations in this guide require a Windows Domain. So, if you’re setting this up in a home lab, you must configure a Windows domain. Also, all hosts – Hyper-V and SCVMM – must be members of the Windows domain.

Task 2: Install Windows Server on the Hyper-V Hosts

In this section, complete the following:

  1. Install Windows Server 2022 Standard or Datacenter. If you’re installing Server Core, follow the steps in my guide, How to Install and Configure Windows Server 2022 Core.
  2. Rename the hosts on the OS.
  3. Enable RDP on all Hosts

Task 3: Rename pNICs on the Hyper-V Hosts

As part of preparing the servers, I renamed the network adapters for ease of identification.

Complete the steps below on each Hyper-V host:

  1. Run the Get-NetAdapter command to list all the network adapters on the server. Then, update the table below with the default names of the NICs in column 2.

Here is the result of the command in one of the Hyper-V hosts in my home lab.

Get-NetAdapter

If you have multiple network adapters, include another MAC address in column 3 to help identify the pNICs when you rename them with the command in step 3.

  1. After that, rename the adapter with the command below:
Get-NetAdapter | Where-Object {$_.MacAddress -eq "A0-CE-C8-3A-DD-E3"} | Rename-NetAdapter -NewName Mgt-pNIC

After renaming the adapter, rerun the Get-NetAdapter command to confirm.

Run the last command for all pNICs on both Hyper-V hosts using the table below as a guide. The second table is the simplified version of my lab setup. 

Host Name Default pNIC Names* MAC Address New pNIC Names Hyper-V SET Name**
IPMpHPV4 Network 1,Network 2 70-5A-0F-3E-8A-CD Mgt-pNIC-1, Mgt-pNIC-2 Mgt-vSwitch
Network 1, Network 2 Clu-pNIC-1,
Clu-pNIC-2
Clu-vSwitch
Network 3, Network 4 Lmg-pNIC-1, Lmg-pNIC-2 Lmg-vSwitch
Network 7*** Str-vSwitch Str-vSwitch
IPMpHPV5 Network 3, Network 4 Mgt-pNIC-1, Mgt-pNIC-2 Mgt-vSwitch
Network 5, Network 6 Clu-pNIC-1,
Clu-pNIC-2
Clu-vSwitch
Network 5,Network 6 Lmg-pNIC-1, Lmg-pNIC-2 Lmg-vSwitch
Network 7 Str-vSwitch Str-vSwitch
Table 2.0
Host Name Default pNIC Names* MAC Address New pNIC Names Hyper-V SET Name**
IPMpHPV4 Network A0-CE-C8-3A-DD-E3 Mgt-pNIC Mgt-vSwitch
IPMpHPV5 Network 70-5A-0F-3E-8A-CD Mgt-pNIC Mgt-vSwitch
Table 2.1

Task 4: Install Required Windows Roles

Install the Hyper-V, Failover Clustering, and Multipath I/O roles on the Hyper-V hosts.

If you do not use Fliber Channel for storage, do not install the Multipath I/O role.

As usual, you can install the roles with Server Manager or run the PowerShell command below:

Install-WindowsFeature Hyper-V,Failover-Clustering -IncludeAllSubFeature -IncludeManagementTools

The above command installs Hyper-V and Failover-Clustering. If you require Multipath I/O, run this command:

Install-WindowsFeature Hyper-V,Failover-Clustering, Multipath-IO -IncludeAllSubFeature -IncludeManagementTools

After installing the roles, restart the servers.

Task 5: Configure Storage

In this section, the storage is set up to be used in configuring the Hyper-V cluster. If you have a storage admin team, request that they assign these LUMs to all Hyper-V hosts.

If your environment uses a Fiber Channel, you must configure MPIO to claim the LUMs.

Task 5.1: Assign Storage LUMs

If you need help configuring the iSCSI virtual disks, read my guide, Configuring Windows Server 2019 as an iSCSI Target Server.

This table, used in my lab, is for guidance purposes. You should use bigger storage capacities for the VMM Shared Library and the Clustered Shared Volume in production.

However, for the Cluster Quorum witness disk, 1 GB is enough.

iSCSI Virtual disk name Size Purpose
ClusterQuorum 1 GB Cluster Quorum witness disk
VMMLibrary 200 GB VMM Shared Library
CSV 821 GB Clustered Shared Volume
Table 2.5

Task 5.2: Connect Hyper-V Hosts to the iSCSI Target

If you use Fiber Channel, skip this sub-section. However, for iSCSI LUMs, connect the Hyper-V hosts to the iSCSI target with the steps below:

If you’re using Fibre Channel LUMs, the servers should be assigned LUMs by now. Ensure that this is done now before proceeding to the next task.

  1. Log in to the Hyper-V host, search iSCSI, and open the iSCSI Initiator app. Windows will display a prompt to start the Windows iSCSI Initiator service, click Yes to start the service.
Log in to the Hyper-V host, search iSCSI and open the iSCSI Initiator app. Log in to the Hyper-V host, search iSCSI and open the iSCSI Initiator app.
Windows will display a prompt to start the Windows iSCSI Initiator service, click Yes to start the service. Windows will display a prompt to start the Windows iSCSI Initiator service, click Yes to start the service.
  1. After that, enter the IP address or FQDN of the iSCSI target in the Target field, then, click the Quick connect button.
After that, enter the IP address or FQDN of the iSCSI target in the Target field, then, click the Quick connect button. After that, enter the IP address or FQDN of the iSCSI target in the Target field, then, click the Quick connect button.

If the iSCSI initiator (your Hyper-V host) connects successfully to the target, a second pop-up will display the IQN of the target with the Status Connected. Click Done and close the iSCSI Initiator app.

If the iSCSI initiator (your Hyper-V host) connects successfully to the target, a second pop-up will display the IQN of the target with the Status Connected.If the iSCSI initiator (your Hyper-V host) connects successfully to the target, a second pop-up will display the IQN of the target with the Status Connected.

Connect all Hyper-V hosts to the iSCSI Target, then proceed to the next task below.

Task 5.3: Configure Disks in Windows Disk Management

Perform the steps in this section on one of the Hyper-V hosts. This should be performed no matter what storage you’re suing. However, for Fibre Channel deployments, you must configure MPIO to claim the FC Disks before proceeding with the steps below.

For Windows Server Core, use Server Manager to connect to the remote server and configure the disks with Server Manager.

  1. Search Disk Management and open the app. The three LUMs assigned to the host will be displayed.
  1. Right-click one of the disks and select Online. Repeat the step for the three disks.
Right-click one of the disks and select Online. Right-click one of the disks and select Online.
  1. After that, right-click one of the disks and select Initiatlize Disk.
  1. A pop-up will display and select the three disks for initialization. Select GPT and click OK.
A pop up will display and select the three disks for initialization. Select GPT and click OK.A pop up will display and select the three disks for initialization. Select GPT and click OK.
  1. Finally, following your storage plan table (see minebelow), create a Simple Volume, then format the volume as NTFS.
Volume Label Size Drive Letter Purpose/Notes
QuorumDisk 1 GB Q Cluster Quorum witness disk.
VMMLibraryDisk 200 GB E (or any available drive letter) VMM Shared Library. Drive letter is required
CSVDisk 821 GB None Clustered Shared Volume. When you configure as a Cluster Share Volume, Windows mounts the volume in c:ClusterDisk
Table 2.6

While creating the CSVDisk volume, on the section o assign drive letter, choose Do not assign drive letter or drive path.

While creating the CSVDisk volume, on the section o assign drive letter, choose Do not assign drive letter or drive path.While creating the CSVDisk volume, on the section o assign drive letter, choose Do not assign drive letter or drive path.

When you finish creating and formating the volume, they should look like the screenshot below.

When you finish creating and formating the volume, they should look like the screenshot below. When you finish creating and formating the volume, they should look like the screenshot below.

Meanwhile, on the other Hyper-V host, they will appear offline. Do not bring the disks online or try to format them on the second host.

Meanwhille, on the other Hyper-V host, they will appear offlineline. Do not bring the disks online or try to format them on the second host. Meanwhille, on the other Hyper-V host, they will appear offlineline. Do not bring the disks online or try to format them on the second host.

Task 6: Create Switches on the Hyper-V Hosts

In this task, you’ll create a Hyper-V Switch Embedded Team (SET) virtual switch. This switch teams two or more physical network cards to provide load balancing and redundancy.

After creating the SET, you’ll configure some settings like changing its Load Balancing Algorithm from HyperVPort (default) to Dynamic. Finally, you’ll enable RDMA (Remote Dynamic Memory Access) on the switch.

Before we begin, it is important to note that a Hyper-V SET can only be created with PowerShell or via Virtual Machine Manager. At this stage of the guide – since we have not deployed SCVMM – we will be creating and configuring the switch with PowerShell.

Complete the task in this section on all Hyper-V hosts. When you create a Hyper-V SET, you can use a single physical network adapter and add more adapters later. To run the commands below, open PowerShell as administrator.
  1. Create the SET with the command below. The command creates a new switch called Mgt-vSwitch (see Table 1.3 in part 1 of this guide).

While creating the switch we enable teaming and SR-IOV.

New-VMSwitch -Name "Mgt-vSwitch" -NetAdapterName "Mgt-pNIC" -EnableEmbeddedTeaming $true -EnableIov $true

When you execute the above command, after the switch is created, PowerShell returns the switch’s basic information. See my screenshot below for details.

When you execute the above command, after the switch is created, PowerShell returns the switche's basic informationWhen you execute the above command, after the switch is created, PowerShell returns the switche's basic information
  1. Change the load balancing algorithm of the switch to Dynamic with the Set-VMSwitchTeam command. Before running the Set-VMSwitchTeam command, if you’re curious, you can confirm the current Load Balancing Algorithm with the Get-VMSwitchTeam.
Get-VMSwitchTeam -Name Mgt-vSwitch

Set-VMSwitchTeam -Name "Mgt-vSwitch" -LoadBalancingAlgorithm Dynamic

After changing the Load Balancing Algorithm, I re-ran the Get-VMSwitchTeam command to confirm that it has changed. See the results of my commands in this screenshot.

  1. Enable RDMA on the switch.
Enable-NetAdapterRDMA "vEthernet (Mgt-vSwitch)" -NoRestart

After enabling RDMA on the switch, you must map the virtual switch to a physical network adapter.

  1. To map the Hyper-V virtual switch, Mgt-vSwitch to the network adapter, Mgt-pNIC, run this command.

You can only map the virtual switch to a physical network adapter.

Set-VMNetworkAdapterTeamMapping -ManagementOS -SwitchName "Mgt-vSwitch" -PhysicalNetAdapterName "Mgt-pNIC"

After the mapping, you can view the details with this command.

Get-VMNetworkAdapterTeamMapping -ManagementOS

The above commands created the management switch. If you need to create a switch for the cluster and live migration traffic (required in a production environment), use the commands below:

I added comments (begins with #) to explain what each command does. When we get to the VMM section of this guide, we will be converting these virtual switches to logical switches. For that to happen, the configuration of this virtual switch must be the same as the VMM logical switch. You do not need to create these switches in a home lab since you wouldn’t have the physical net adapters.

When you create a Hyper-V virtual switch that requires setting Minimum Bandwidth by Weight (required and recommended for the cluster and live migration switches), you must use the MinimumBandwidthMode parameter to set the mode to Weight. If this is not specified or SR-IOV is disabled, the default MinimumBandwidthMode is set to absolute.

#create a vSwitch for the cluster traffic and set its MinimumBandwidthMode to Weight

New-VMSwitch -Name "Clu-vSwitch" -NetAdapterName "Clu-pNIC-1" -EnableEmbeddedTeaming $true -EnableIov $false -MinimumBandwidthMode Weight

#change the load-balancing algorithm - default is Hyper-V

Set-VMSwitchTeam -Name "Clu-vSwitch" -LoadBalancingAlgorithm Dynamic

#set vLAN ID #If VLAN ID is not required, ignore this command

Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "Clu-vSwitch" -Access -VlanId 28

#Turn the Virtual Machine Queue weight to 100 - same as the value set in the default Cluster Port profile in VMM
#Set the MinimumBandwidth weight to 10 #use the same vLAN for LM and Cluster traffic.

Set-VMNetworkAdapter -ManagementOS -Name "Clu-vSwitch" -VmqWeight 100 -MinimumBandwidthWeight 10

#create a vSwitch for the Live Migration traffic and set its MinimumBandwidthMode to Weight

New-VMSwitch -Name "Lmg-vSwitch" -NetAdapterName "Lmg-pNIC-1" -EnableEmbeddedTeaming $true -EnableIov $false -MinimumBandwidthMode Weight

#change the load-balancing algorithm - default is Hyper-V

Set-VMSwitchTeam -Name "Lmg-vSwitch" -LoadBalancingAlgorithm Dynamic

#set vLAN ID #If VLAN ID is not required, ignore this command

Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "Lmg-vSwitch" -Access -VlanId 24

#Turns the Virtual Machine Queue weight to 100 - same as the value set in the default Cluster Port profile in VMM
#Set the MinimumBandwidth weight to 40 - this is the setting for the Live Migration Port Profile in VMM

Set-VMNetworkAdapter -ManagementOS -Name "Lmg-vSwitch" -VmqWeight 100 -MinimumBandwidthWeight 40

Task 7: Assign IPs to the Virtual Switches on Hyper-V Hosts

In this task, you’ll assign static IP addresses to the Hyper-V virtual switches yiu created in task 6. For my lab configuration, I used the table below:

Host Name Purpose Hyper-V vSwitch  IP Address(es)
IPMpHPV4 Hyper-V Host Mgt-vSwitch 192.168.0.101
    Clu-vSwitch 192.168.1.11
    Lmg-vSwitch 192.168.2.11
IPMpHPV5 Hyper-V Host Mgt-vSwitch 192.168.0.102
    Clu-vSwitch 192.168.1.12
    Lmg-vSwitch 192.168.2.12

If you’re configuring on a Windows Server Core, from the SConfig console, select option 8.

From my experience, sometimes, assigning IP addresses using SConfig fails. If that happens, select option 15 on the SConfig menu to load the PowerShell coommand console.

Then, run the command like the one below to assign static IP addresses to the Hyper-V switches.

Get-NetAdapter | New-NetIPAddress -IPAddress 192.168.0.154 -PrefixLength 24 -DefaultGateway 192.168.0.1

If you configured VLAN IDs on the Hyper-V switches, run the command – Get-VMNetworkAdapterVlan -ManagementOS – to confirm that VLANs are configured correctly.

Task 8: Join all Hosts to the Domain

You can join a host to the domain via Computer Properties. Alternatively, run the Add-Computer PowerShell command to join the computer to your domain.

Here is a sample command:

Before you run the command, change the domain name and the credentials. When you execute the command, PowerShell will request for the password to the account. The computer will restart automatically.

Add-Computer -DomainName lab.infopressmedia.com -Credential (Get-Credential labadministrator) -Restart 

Task 9: Configure Firewall on the Hyper-V Switches

In this task, we will configure the Windows Firewalls required by the Hyper-V hosts.  Run these commands on each Hyper-V host (IPMpHPV4 and IPMpHPV5 in my lab).

To avoid errors, run the commands one line at a time. Alternatively, copy the whole command into PowerShell ISE (run it as administrator) and execute them simultaneously.
#Set firewall rules.
[System.String[]]$Alias=@("vEthernet (Mgt-vSwitch)");
$Profile="Any"
$Name="File and Printer Sharing"
$rules = Get-NetFirewallRule -DisplayGroup $Name

ForEach ($rule in $rules) { $rule | Get-NetFirewallAddressFilter | Set-NetFirewallAddressFilter -LocalAddress Any -RemoteAddress Any }

Set-NetFirewallRule -DisplayGroup $Name -Enabled True -Profile $Profile -InterfaceAlias $Alias

$Profile="Any"
$Name="FPS-LLMNR-In-UDP"
Set-NetFirewallRule -Name $Name -Enabled True -Profile $Profile

$Profile="Any"
$Name="Windows Remote Management"
Set-NetFirewallRule -DisplayGroup $Name -Enabled True -Profile $Profile -InterfaceAlias $Alias

#Disable IPV6

Disable-NetAdapterBinding -Name "Adapter Name" -ComponentID ms_tcpip6

Task 10: Create a Windows Admin Center (WAC) VM

This section is required for a Windows Server Core deployment.

Complete – How to Set up Hyper-V to Install VMs from a Remote ISO Share – before proceeding. Otherwise, you will not be able to create the VM to install OS using the remote ISO file.

If you’re configuring Hyper-V in Windows Server Core, install Hyper-V management tools in your Domain Controller. To install the Hyper-V Management tool, run the command below:

Install-WindowsFeature -Name RSAT-Hyper-V-Tools #install the GUI mgt and PowerShell modules

Before creating the WAC VM on one of the Hyper-V Server Core hosts, run the command below (via the host’s console) to create the folder for storing the VM:

New-Item -Name IPMvWAC -path "c:Virtual Machines" -ItemType Directory

Finally, use the Hyper-V Manager console installed on your DC to connect to the Windows Server Core. Then, create a Gen 2 VM with the specs in the table below.

VM Name Number of CPUs RAM (MB) Virtual Hard Disk
IPMvWAC 1 8192* 90 GB

*If installing in a lab, you can assign 2048 MB of RAM, the set dynamic memory with a min of 512 GB and max of 4096 MB

After creating the VM, if you use VLAN ID, remember to assign the VM’s virtual NIC to the VLAN ID:

Create a Windows Admin Center (WAC) VMCreate a Windows Admin Center (WAC) VM

Before proceeding to Task 11, install Windows Server on the WAC VM, then complete the following tasks:

  1. Rename the server in Windows
  2. Assign a static IP address
  3. Join VM to the domain
  4. Enable RDP
  5. Set Time zone
  6. Patch the server

Task 11: Configure Windows Server Core

If you’re installing Server Core, use the steps in my guide, How to Install and Configure Windows Server 2022 Core.

Task 12: Install Windows Updates and Drivers

For a Windows Server Core configuration, follow the steps in my guide, Update Drivers in WAC Managed Hosts.

Congratulations! You have completed part 2 of this hands-on guide. Proceed to part 3 – Deploy Hyper-V Cluster.

[ad_2]

Victor Ashiedu

Source link