Over last years, I used to take Hyper-V for server virtualization of different kinds of Microsoft technologies like Windows Server with Lync / Skype for Business and SharePoint or Forefront products. I’m absolutely inexperienced with Citrix XenServer, so I thought to myself that I needed to get more practice with it and to get an better understanding of the capabilities. However, I didn’t want to switch my workstation from the familiar Hyper-V to XenServer and I didn’t have any physical server to install XenServer bare metal on it.
Hmm, so why not try to virtualize the new Citrix XenServer 7 with Hyper-V? It’s not listed as a supported guest system for Hyper-V, but different versions of CentOS are listed and XenServer itself is based on CentOS.
After some attempts I got it and in the next steps I’ll show the required configuration to get it to work.
Create and configure virtual machine
First, I needed to create a new virtual machine. Most prerequisites are described in the installation guide for Citrix XenServer 7.
With these information, I created a generation 1 VM with 2 vCPUs, 8 GB of non-dynamic RAM, one network interface card and a hard disk drive with 50 GB of disk space. It is very important to use a legacy NIC with enabled MAC spoofing and to initialize the virtual hard disk drive before the VM is running and the setup is starting. Also, with Windows Server 2016 and Windows 10 Anniversary Update it is possible to use Nested Virtualization. If your CPU is an Intel processor with VT-x and EPT technology because it is needful to expose the virtualization extension from the host to the guest system.
The new feature Nested Virtualization allows to run a Hypervisor inside a Virtual Machine running on a Hypervisor; also a virtual machine in a virtual machine.
Here is an example of my VM creation script which covers the points described above:
#Create virtual machine
$VMNAME = Read-Host "VM Name"
New-VHD -Dynamic -Path ($VHD = "C:\Hyper-V\Virtual Hard Disks\$VMNAME-$(get-date -f yyyy-MM-dd_HH-mm-ss).vhdx") -SizeBytes 50GB
New-VM -Generation 1 -Name $VMNAME -NoVHD -Version 8.0
Add-VMHardDiskDrive -VMName $VMNAME -Path $VHD
Set-VMMemory -VMName $VMNAME -StartupBytes 8GB -DynamicMemoryEnabled $false
Set-VMProcessor -VMName $VMNAME -Count 2 -ExposeVirtualizationExtensions $true
Remove-VMNetworkAdapter -VMName $VMNAME
Add-VMNetworkAdapter -VMName $VMNAME -Name "eth0" -DynamicMacAddress -IsLegacy $true
Set-VMNetworkAdapterVlan -VMName $VMNAME -VMNetworkAdapterName "eth0" -Access -VlanId 1001
#Mount, Initialize and Dismount virtual hard disk
Mount-VHD -Path $VHD
Get-Disk | Where partitionstyle -eq ‘raw’ | Initialize-Disk -PartitionStyle MBR -PassThru |
New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel “InitDisk” -Confirm:$false
Dismount-VHD -Path $VHD
In my lab I used some VLANs. If you use my template make sure to remove or modify the VLAN ID. You can also configure most of the options with the graphical user interface of the Hyper-V Manager and the Disk Management tool.
If the virtual hard disk isn’t initialized or there is no legacy network interface assigned, the setup will not be able to succeed and one of these messages will appear:
“This host does not appear to have any network interfaces.”
“No disk with sufficient space to install XenSerrver on was found.”
Then I mounted the XenServer 7 install image manually and started the VM to run the setup.
Run XenServer 7 Setup
The installation of XenServer 7.0 is quite simple; a setup wizard with a minimal user interface will collect the needed parameters like hostname, network configuration, password and so on. After all the information is provided the installation can be started.
Here are some impressions of the installation process:
Manage XenServer remotly
After the installation is completed, the system can be managed remotely via XenCenter. This is a graphical, Windows-based management software, which can be downloaded from the XenServer itself; simply type the ip-address of the server into a web browser:
After installing XenCenter, I connected to the XenServer and created a small Windows 7 virtual machine based on the default template for “testing” of the nested virtualization. The installation works fine and without errors.
It is necessary to install the XenServer guest tools to get optimized performance.
If the Windows 7 virtual machine should get network Access, the virtual XenServer needs additional configuration in the Hyper-V virtual machine settings. This feature is called “MAC Address Spoofing”. Per default, Hyper-V will block the traffic from the nested virtual machine because without MAC Address Spoofing the MAC Address of the VM inside the VM isn’t valid and the Hyper-V switch will discard the network packets.
This can be enabled under the Advanced Features section of the virtual NICs network settings of the according virtual machine – not in the Hyper-V virtual switch manager.
Here is the according PowerShell command:
Set-VMNetworkAdapter -VMName "XenServer-A" -VMNetworkAdapter "eth0" -MacAddressSpoofing On -Verbose
After these steps, I can play around with the XenServer as a Hyper-V virtual machine. I didn’t test whether all features work well or the performance of the nested VMs is good. However, for my purpose it is sufficient, at least for the moment.
For all Readers: keep in mind that this isn’t a supported scenario and should only be used for testing, but it is nice to know that Hyper-V works well this scenario 🙂
Latest posts by Eric (see all)
- Skype for Business Server 2015 & .NET Framework 4.6.2 Compatibility - 1. March 2017
- Install Citrix XenServer 7 on Hyper-V - 28. December 2016
- Install Ferrari electronic OfficeMaster Gate (virtual edition) – Part 1 - 29. May 2016