The converged virtual network within Hyper-V deployments is a common configuration. There are multiple ways to deploy the converged network configuration. The simplest method is using the PowerShell cmdlets and a slightly complex way (if you are new to System Center) is using the System Center Virtual Machine Manager. Whatever method you choose, the idea is keep the configuration consistent across the hosts in the deployment. Now, when we talk about configuration and Windows, what is better than using Desired State Configuration?
Recently, I completed writing a bunch of custom DSC resources to deploy Hyper-V converged networks in my lab! I am happy to share that work with you all today. This release of DSC resources includes two modules and a total of four new resources and update to VM switch DSC resource written by Microsoft. So, the number of DSC resources developed by PowerShell Magazine is now increased to 26! 🙂
Before we look at DSC resources in this release, let us take a look at what a Hyper-V converged network is and then map that into the DSC resources that I built.
What is shown above is a typical converged network created on a Hyper-V host. In the scenario I am demonstrating, we have multiple network ports on a physical host that are teamed together to provide load balancing as well as failover. Using the network team that we create, we deploy a Hyper-V virtual switch and add multiple network adapters in the management OS or the root partition. Also, these network adapters are given some bandwidth weight and VLAN configuration. The bandwidth configuration ensures that the host adapters do not overrun the VM network traffic or to ensure they get enough bandwidth when required.
So, to be able to complete this deployment using DSC, we need multiple resources. This is what today’s release is about.
|Resource Name||Module Name||New or Updated||Purpose|
|cNetworkTeam||cWindowsOS||New||Create a Network Team from physical network interfaces.|
|cVMSwitch||cHyper-V||Updated||Create Hyper-V Virtual Switch that can be used for converged networking. Note: xVMSwitch from xHyper-V was the base for this resource. I added changes to configure Bandwidth reservation mode and IoV settings.|
|cVMNetworkAdapter||cHyper-V||New||Create and add a new VM network adapter to either the management OS or a Hyper-V virtual machine.|
|cVMNetworkAdapterSettings||cHyper-V||New||Configure bandwidth reservation and other settings on the VM adapter in both management OS or VM.|
|cVMNetworkAdapterVlan||cHyper-V||New||Configure VLAN settings on the VM adapter in both management OS or VM.|
While my application of the following DSC resources is deploying a Hyper-V converged network, their functionality is more generic and granular. I could have combined cVMNetworkAdapter, cVMNetworkAdapterSettings, and cVMNetworkAdapterVlan into a single resource. However, that would only increase the complexity of authoring and have too many resource properties to deal with.
Note: The xHyper-V resource module contains additional resources for dealing with VMs and VHDs. I have not added them except the cVMSwitch to the cHyper-V resource module as I have not modified any of them.
You can download these resource modules from my Github repo. These resource modules are available on PowerShell Gallery as well. So, if you are running WMF 5.0, you can download these using the Install-Module cmdlet.
Install-Module -Name cWindowsOS Install-Module -Name cHyper-V
In today’s article, I have only introduced these resources and their purpose. I will walk-through each of these resources and show you how to build a Hyper-V converged network. Stay tuned!
Meanwhile, feel free to explore the resources yourself (no rocket science, really!) and let me know what you think.