Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Configuring Hyper-V Replica on Azure – PART 1

  • November 29, 2018
  • 10 min read
IT Production Manager. Nicolas is primarily focused on Microsoft technologies, he is a Microsoft MVP in Cloud and Datacenter Management.
IT Production Manager. Nicolas is primarily focused on Microsoft technologies, he is a Microsoft MVP in Cloud and Datacenter Management.

wp-image-10435

Introduction

If you work with Azure, you probably know that you can run Hyper-V in Azure using the Nested Virtualization. Why? It can be interesting to use this architecture for testing purpose. Of course, the price will be always higher than a local hardware in your own on-premises lab. You can use Nested Virtualization since Windows Server 2016 and Windows 10.

To create a new Virtual Machine, you must use one of the instance sizes like Ev3 or Dv3. So, in a next article, I will explain how to create and configure your Hyper-V Host in Azure from scratch, but in this guide, I will use the great JSON template created by Chris Pietschmann to easily deploy the Hyper-V hosts.

Getting Started

Before going deeper, I must say that this environment is not supported by Microsoft. However, you can use it for self study and lab. This guide will split into two parts:

  • The first part will be focused on how to deploy the environment.
  • and the second part will be focused on how to configure the environment.

I will use the following architecture which is very simple:

wp-image-10436

In this architecture, I will deploy two Hyper-V hosts:

  • The first one is called “Hypv-Europe“, which will be located in the Resource Group 1
  • and the second one is called “Hypv-France“, which will be located in the Resource Group 2

The only requirement is that the two Azure VMs must have network connectivity. So, both Resource Group will be connected using Azure Network Peering. You can find more information about Network Peering here:

https://www.starwindsoftware.com/blog/azure-virtual-network-peering.

Network Peering is similar to a Site-To-Site VPN, except that you are connecting two Azure Virtual Networks. When you peer two Virtual Networks, then resources in both VNet can communicate with each other as though the resources were in the same Virtual Network.

Once the configuration is done, we will be able to configure Hyper-V in order to replicate a Virtual Machine hosted on “Hypv-Europe” to “Hypv-France“.

Creating Resource Group and Virtual Network

First step, you must create two Resource Groups in order to store your Hyper-V Hosts. Below is the PowerShell code to create a Resource Group:

wp-image-10437

Once the Resource Group is created, we need to create a Virtual Network associated to this Resource Group. From the Azure Portal, go to the “Virtual Network” blade:

wp-image-10438

Repeat these steps to create the second Resource Group and the second Virtual Network. Be careful to not overlap with other networks.

At this step, you should have two Resource Groups, and two Virtual Networks.

Creating Virtual Network Peering

Navigate to the Virtual Network blade and click “Peerings”. You can peer a VNet with one or more VNet.:

wp-image-10439

Click “Add” and then select the VNet partner and validate the wizard. The peering must be created in both directions to enable resources in the virtual networks to communicate with each other. Go back to the Peerings blade and confirm the status:

wp-image-10440

At this step, both Virtual Network are connected.

More information about Virtual Network pricing:

https://azure.microsoft.com/en-us/pricing/details/virtual-network/

Deploying Two Hyper-V Hosts

To deploy the Hyper-V Hosts, you must click on the following button to open the Azure Portal and create your first Hyper-V Host in the first Resource Group previously created. This template will use the Dv3 and Ev3 VM sizes, which allow you to use Nested Virtualization.

Please note that nested virtualization is only supported in Windows Server 2016 and Windows 10.

wp-image-10441

You can change some settings to suit your needs:

wp-image-10442

Now, just wait 15 minutes until the deployment is done and repeat this step to deploy your second Hyper-V host in the second Resource Group.

In my case, I deployed two Hyper-V hosts:

  • Hypv-europe is located in the Resource Group called “Nico-RG04
  • Hypv-france is located in the Resource Group called “Nico-RG02

wp-image-10443

Connect through RDP to your Hyper-V hosts and run the following command to enable ICMP in the Windows firewall:

wp-image-10444

Next, at both Azure VMs you must also open the 443 port at both the NSG and the Windows Firewall. Network Security Group (NSG) allow you to create Inbound security rules and Outbound security rules.

Once the security rules are created, you must associate both Hyper-V NICs to this NSG:

wp-image-10445

 

Verifying Hosts Communication

Hyper-V Replica uses computer names, so I will modify the host file to bind the IPs with the computer names. On the first Hyper-V Virtual Machine, browse to the following path “C:\Windows\System32\drivers\etc“, and open the “hosts” file. Then, enter the IP of the second Hyper-V Virtual Machine following by the computer name.

In my case, both Hyper-V VMs are not domain joined:

  • on Hypv-Europe, I will map “10.200.200.4” to “Hypv-France
  • on Hypv-France, I will map “10.0.0.4” to “Hypv-Europe

wp-image-10446

You can perform the same task on the second Hyper-V VM.

wp-image-10447

You must confirm that you can ping both Virtual Machine. At this step, if it does not work, then you must check your Virtual Network configuration. Be sure that the peering status between both VNet is “connected” and check your NSG or Windows Firewall.

If it works, then you can move to the second part of this guide to configure your first Hyper-V replica.

Conclusion

Thanks to the first part of this guide, you should be able to create your own Hyper-V lab on Azure. You can use both Hyper-V hosts to test the Hyper-V features, especially if you do not have your own lab at home.

Thanks for reading!

Hey! Found Nicolas’s article helpful? Looking to deploy a new, easy-to-manage, and cost-effective hyperconverged infrastructure?
Alex Bykovskyi
Alex Bykovskyi StarWind Virtual HCI Appliance Product Manager
Well, we can help you with this one! Building a new hyperconverged environment is a breeze with StarWind Virtual HCI Appliance (VHCA). It’s a complete hyperconverged infrastructure solution that combines hypervisor (vSphere, Hyper-V, Proxmox, or our custom version of KVM), software-defined storage (StarWind VSAN), and streamlined management tools. Interested in diving deeper into VHCA’s capabilities and features? Book your StarWind Virtual HCI Appliance demo today!