In this article, I want to share my experience installing and configuring the Hyper-V Server 2012R2 hypervisor from Microsoft. So let's get started. Given: 2 servers and iscsi storage.
1. Image preparation
Download the image to install the server from Microsoft. If you have a deployed Windows Deployment Services service or an installed Windows Deployment and Assessment Toolkit (
Windows ADK ) installed, you can unpack the 7-zip distributive from the link above into a folder, for example,
D: \ W2012 \ x64 \ dvd . Then received
windows updateWindows8.1-KB2919355-x64.msu
Windows8.1-KB2919442-x64.msu
Windows8.1-KB2932046-x64.msu
Windows8.1-KB2934018-x64.msu
Windows8.1-KB2937592-x64.msu
Windows8.1-KB2938439-x64.msu
Windows8.1-KB2959977-x64.msu
copy to the folder
D: \ W2012 \ x64 \ upd , create the folder
D: \ W2012 \ mnt and use the following batch file to update the image.
Script update and image modificationsDism / Mount-WIM /WimFile:D:\W2012\x64\DVD\sources\install.wim / index: 1 / MountDir: D: \ W2012 \ mnt
dism / image: D: \ W2012 \ mnt / Enable-Feature / FeatureName: MultipathIo
dism / image: D: \ W2012 \ mnt / Enable-Feature / All / FeatureName: NetFx3 / Source: d: \ W2012 \ x64 \ dvd \ sources \ sxs
dism / image: D: \ W2012 \ mnt / Add-Package / PackagePath: d: \ W2012 \ x64 \ upd
Dism / Unmount-Wim / MountDir: D: \ W2012 \ mnt / commit
pause
The unpacked distribution package can be rebuilt into a bootable iso, for example, using the Ultraiso program, opening the source image in it and adding the
install.wim file from the
D: \ W2012 \ x64 \ dvd \ sources folder to the
Sources folder and saving the resulting image. Again, all the above-described manipulations can be omitted, the updated image will speed up the deployment of the Hyper-V server.
2. Installation
If the source disk for the server installation exceeds 2TB in size, then in order to be able to use all the possible disk space you need to convert the disk to GPT and partition it before starting the installation. It is not possible to do this during the installation.
')
You need to boot into PE mode from the installation disk and run diskpart.
Convert MBR to GPT using DISKPART
# Diskpart # select disk 0 # convert gpt # create partition primary align=64 offset= 104857600
For further installation, you need to set the UEFI boot in the server's BIOS (but this is if your server’s local storage exceeds 2 TB, if not, you can skip this step)
3. Initial setup
We include Remote Desktop in sconfig (point 7-e-2):

Enable ping (clause 4-3):

At the command line, launch powershell and disable the firewall (you can skip):
Set-NetFirewallProfile –Profile * -Enabled False
4. Configure the virtual switch
Setting the MAC address pool for the virtual switch (change the selected values, ie, take the last octet of the ip address (for example, 192.168. 251.
11 ) of the mgmt interface and translate it into hexadecimal):
New-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization” -Name MinimumMacAddress -PropertyType Binary -Value ([byte[]](0x00,0x15,0x5D,0xFB,0x0B,0x00)) –Force New-ItemProperty -Path “HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization” -Name MaximumMacAddress -PropertyType Binary -Value ([byte[]](0x00,0x15,0x5D,0xFB,0x0B,0xFF)) –Force
This is to ensure that the MAC addresses of virtual servers located on different hyper-v host do not overlap. By default, they are issued from the same range and may turn out to be the same, as I happened during the implementation on one object.
Getting a list of network adapters:
Get-NetAdapter
PS C:\Users\Administrator> Get-NetAdapter Name InterfaceDescription ifIndex Status MacAddress LinkSpeed ---- ----------------- ------- ------ ---------- --------- NIC4 Broadcom NetXtreme Gigabit Ethernet #2 14 Up C8-1F-66-D1-CB-FA 1 Gbps NIC3 Broadcom NetXtreme Gigabit Ethernet #4 16 Up C8-1F-66-D1-CB-F9 1 Gbps NIC2 Broadcom NetXtreme Gigabit Ethernet #3 15 Up C8-1F-66-D1-CB-F8 1 Gbps NIC1 Broadcom NetXtreme Gigabit Ethernet 13 Up C8-1F-66-D1-CB-F7 1 Gbps
We need - NIC1 and NIC2.
Combining adapters into a group (Team1):
New-NetLbfoTeam –Name Team1 –TeamMembers “NIC1”,“NIC2” –TeamingMode Lacp –LoadBalancingAlgorithm Dynamic
Creating a virtual switch (vSwitch0):
New-VMSwitch -Name vSwitch0 -NetAdapterName Team1 -AllowManagementOS $False -MinimumBandwidthMode Weight
Creating a virtual set. adapter (Management) and connect it to a virtual switch:
Add-VMNetworkAdapter -ManagementOS -Name "MGMT" -SwitchName "vSwitch0" Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "MGMT" -Access -VlanId 251 Set-VMNetworkAdapter -ManagementOS -Name "MGMT" -MinimumBandwidthWeight 20
The ports on the physical switch are configured on the trunk and Vlan 251. In this example, this is the subnet for managing the Hyper-V server.
Setting the IP address, mask, gateway and DNS server on the virtual adapter (MGMT): item 8 of the sconfig menu (for example: 192.168.251.11/24, gw 192.168.251.1):
After that, the server should ping and you can use remote access.
Connect via RDP, create a virtual network adapter (Cluster) and connect it to the virtual switch:
Add-VMNetworkAdapter -ManagementOS -Name "Cluster" -SwitchName "vSwitch0" Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "Cluster" -Access -VlanId 253 Set-VMNetworkAdapter -ManagementOS -Name "Cluster" -MinimumBandwidthWeight 40
5. Connecting storage
We will proceed from the assumption that the storage system is already configured and connected to the corresponding ports of the switch. Configure ip-addresses for interface iscsi adapters:
Start powershell from the command line:
New-NetIPAddress -InterfaceAlias "NIC3" -IPAddress 192.168.254.22 -PrefixLength 24 New-NetIPAddress -InterfaceAlias "NIC4" -IPAddress 192.168.255.22 -PrefixLength 24 Set-Service –Name MSiSCSI –StartupType Automatic Start-Service MSiSCSI New-IscsiTargetPortal –TargetPortalAddress 192.168.254.12 $target = Get-IscsiTarget $target = Get-IscsiTarget $target| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 192.168.254.22 -TargetPortalAddress 192.168.254.12 $target| Connect-IscsiTarget -IsPersistent $true -IsMultipathEnabled $true -InitiatorPortalAddress 192.168.255.22 -TargetPortalAddress 192.168.255.12 Get-IscsiSession | Register-IscsiSession
With Broadcom NetXtreme network adapters, an unpleasant bug emerged, which was expressed in the fact that the drivers in the image had a very low network transfer rate of 3 to 5 MB / s on a gigabit connection. Low network performance -
This is a driver update to this issue. If you have the following actions:
Disable VMQ on the Virtual Network Adapter by using the following Windows PowerShell cmdlet:
Set-VMNetworkAdapter –ManagementOS -Name MGMT -VmqWeight 0
We fix or update drivers manually.
6. Install the necessary roles
Installing the necessary roles, the server must be connected to the Internet:
Dism /online /enable-feature:MultipathIo DISM /online /Enable-Feature /all /FeatureName:NetFx3
This is if you have not modified the image, as described in paragraph 1.
We add support for SAS and iSCSI in the mpiocpl snap-in and after rebooting in the disk manager, the LUNs will not be duplicated if the server is connected in two or more ways.
mpclaim -n -i -d "HP MSA 1040 SAN"
(six spaces required)

Check:
diskpart # list disk

When adding a new volume to the storage system, execute in powershell:
Get-Disk Initialize-Disk -Number <Number of disk> -PartitionStyle GPT -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume
Setting the time (after adding the server to the Windows domain, the time will be synchronized with the PDC):
At the command prompt:
sc config w32time start= auto net start w32time
If necessary, manually:
Control timedate.cpl
ps
Corrected some text and formatting
Cluster configuration will be described later.