Using DSC to deploy Hyper-V converged virtual network – Configuring Host VM Adapters (Part 3)
In an earlier article, I had introduced DSC resources that can be used to deploy a Hyper-V converged virtual network. In this series of articles, we will build the converged network configuration for what is shown below.
Here is a recap of configuration needed.
- Create a host network team.
- Create a VM switch using the host team.
- Create host VM adapters in the management OS to connect to the VM switch and assign VLANs and bandwidth settings (today’s article).
- Assign IP addresses and DNS addresses, as required.
In the earlier article, we created a network team named HostTeam and deployed a VM switch using that network team. In today’s article, we will see how to create virtual network adapters that are required for the Hyper-V cluster.
Creating VM Network adapters using cVMNetworkAdapter DSC resource
If you have not downloaded the new DSC resource modules yet, you can do so from my Github repo or using the Install-Module cmdlet in WMF 5.0. To create a converged virtual switch, we will need the cVMNetworkAdapter resource from the cHyper-V module. The cVMNetworkAdapter can be used to create VM network adapters either in the management OS or connect network adapters to VMs.
In this resource properties, the Name represents the name of VM network adapter. The SwitchName property represents the name of the virtual switch this VM network adapter should be connected to. Apart from these two mandatory properties, the ManagementOS property is a mandatory property as well. If you are connecting to the VM adapter to the management OS, set this property to $true. If you are configuring the VM network adapter for a virtual machine, you must set the ManagementOS property to $false and use the VMName property to specify the name of the VM to which the adapter needs to connect.
By default, the VM network gets a dynamic MAC address gets assigned to it. If you need to set a static MAC address, you can use the StaticMacAddress property. Here is an example configuration.
|
|
Now, coming back to the converged virtual network configuration, we need to have three network adapters in the management OS – Management, Cluster, and LiveMigration. In the last article, I showed you how to create the VM switch using cVMSwitch resource. Since we have set AllowManagementOS to $true, the VM switch creation also creates a network adapter in the management OS with the same name as VM switch. So, we don’t have to create another adapter for management purpose. We can use the adapter that is created along with the VM switch for all management related traffic. That leaves us with two more adapters – Cluster and Live Migration. Here is the complete configuration that I am using to create a host team, VM switch, and finally the VM network adapters.
|
|
This will create two more network adapters in the management OS and attach them to the HostSwitch that we configured earlier.
Configuring Bandwidth settings
Once the management adapters are created, we can assign the bandwidth reservation or priority settings as needed. Since we set the MinimumBandwidthMode to Weight during VM switch creation, we need to specify the percentage of bandwidth reservation for each adapter. We use cVMNetworkAdapterSettings DSC resource for this purpose. This DSC resource can used for many other settings such as DhcpGuard, RouterGuard and so on.
There are three mandatory properties similar to the cVMNetworkAdapter DSC resource. You must specify the Name, SwitchName, and ManagementOS properties.
The MaximumBandwidth property is used to specify the maximum bandwidth, in bits per second, for the virtual network adapter. The MinimumBandwidthAbsolute specifies the minimum bandwidth, in bits per second, for the virtual network adapter. By default, these properties are set to zero which means those parameters within the network adapter are disabled. The _MinimumBandwidthWeight _specifies the minimum bandwidth, in terms of relative weight, for the virtual network adapter. The weight describes how much bandwidth to provide to the virtual network adapter relative to other virtual network adapters connected to the same virtual switch.
If you want allow teaming of network adapters in the guest OS, you can set the AllowTeaming property to On. By default, this is set to Off and therefore disallows network teaming inside guest OS. Similar to this, there are other settings of a VM network adapter that you can configure. These properties include DhcpGuard, MacAddressSpoofing, PortMirroring, RouterGuard, IeeePriorityTag, and VmqWeight. These properties are self explanatory and are left to defaults for a VM network adapter.
For now, we will limit our discussion only to bandwidth settings. Here is a sample configuration using this resource.
|
|
As shown in the converged network diagram at the beginning, I am giving bandwidth weight of 10, 20, and 30 to HostSwitch, HostCluster, and HostLiveMigration adapters respectively. So, for my scenario, here is the configuration script that creates a host team, VM switch, VM network adapters in the management OS, and finally configures the bandwidth settings for each adapter.
|
|
After we apply this configuration, we can verify the bandwidth settings using the Get-VMNetworkAdapter cmdlet.
|
|
Configuring VLAN settings
In a production environment, when using converged network configuration, you should not mix different types of traffic originating from host and virtual machines. This configuration on the network adapters can be done using the cNetworkAdapterVlan DSC resource.
When configuring the VLAN settings for a VM network adapter, you must specify the Name of the adapter and whether that belongs to ManagementOS or not. If the VM adapter belongs to a VM, you should set the ManagementOS property to $false and specify a VM name using the VMName property. The AdapterMode property specifies the operation mode of the adapter and is by default set to Untagged which means there is not VLAN configuration. The possible and valid values for this property are Untagged, Access, Trunk, Community, Isolated, and _Promiscuous. _Each of these modes have a corresponding VLAN property that is mandatory. For example, if you set the AdapterMode property to Access, then it is mandatory to provide VlanId property. Similarly, if you set the AdapterMode to Trunk, the NativeVlanId property must be specified. The following table describes the properties that must be set and the optional properties for each operating mode.
AdapterMode | Mandatory Property | Optional Property |
---|---|---|
Untagged | – | – |
Access | VlanId | – |
Trunk | NativeVlanId | AllowedVlanIdList |
Community | PrimaryVlanId | SecondaryVlanId |
Isolated | PrimaryVlanId | SecondaryVlanId |
Promiscuous | PrimaryVlanId | SecondaryVlanIdList |
Here is a sample configuration script that shows cNetworkAdapterVlan resource in action.
|
|
In the scenario that I am building I have to configure VLAN 10, 20, and 30 for the HostSwitch, HostCluster, and HostLiveMigration adapters respectively. Let us see the complete configuration script now.
|
|
Once we apply this configuration, it completes the creation of converged virtual network. The VLAN settings can be verified using the Get-VMNetworkAdapterVlan cmdlet.
|
|
This brings us to the end of today’s article. Tomorrow, we will see how we can assign IP address configuration to the VM adapters we created in this converged virtual network.
Share on: