Configuring the Virtual Network using Converged Networks

Networking can be one of the hardest part in a Hyper-V installation, special the physical network. As per Microsoft best practices, a Hyper-V in a cluster environment requires a network card for the cluster network, Live Migration, the management Operating System, CSV and the virtual network used for virtual machines. That would need a server with at least five physical network. In older Windows versions, you would also need a hardware based network teaming. Not mentioning that this would be a “simple” scenario for Hyper-V. Besides the complexity of configuring and managing these networks, it would be quite expensive too.

The first feature in Windows Server 2012 that solved part of the problem was the NIC Teaming, which is now part of the Operating System. Now you do not need to worry about hardware to create a network team. It also supports most of the network adapters out there.

A second feature in Windows Server 2012 allows networks to be “converged” into physical network, called Converged Network.

These two features together brings the solution for all the mess and high prices of virtual networks in Hyper-V deployments.

This recipe will guide you through all the step-by-step to configure the networks for your Hyper-V servers in a cluster using NIC Teaming and Converged Networks.

Getting ready

Our scenario have only two 10GB network cards on each physical server. Make sure you have all hardware and physical components ready.

The network cards and drivers should also be installed in both servers.

In this recipe, each server has two network adapters called NIC01 and NIC02.

How to do it…

The following steps will demonstrate how to create a NIC Teaming with two network adapters and how to create a Converged Network to be used for Live Migration, Management OS, CSV and virtual machines.

1. From one of the servers that will be in the cluster, open Server Manager and click on Local Server.

2. Click on the Disabled link besides NIC Teaming.

3. In the NIC Teaming window, under TEAMS, click TASKS and then New Team, as shown in the following screenshot.

1485EN_02_02

4. In the NIC Teaming window, under Team name, add the name for your team.

5. Under Member adapters, select the network interfaces you want to add into the NIC Teaming.

6. Click on Additional properties, make sure Switch Independent and Dynamic are selected, as shown in the screenshot.

1485EN_02_03

Note: Please discard my example above where I had 2 NICs with different speed. This was my lab server with limited resources. Don’t do that at home! =)

7. Once finished, click OK to create your NIC Teaming.

8. Open Windows Powershell and type the following command to create a Virtual Switch called ConvergedHVSwitch using the NIC Teaming HyperVTeam created in step 6 with the bandwidth mode set to Weight.

New-VMSwitch -Name ConvergedHVSwitch -NetAdapterName HyperVTeam -AllowManagementOS $False -MinimumBandwidthMode Weight

9. After creating the Virtual Switch, add the three network adapters called Management, LiveMigration and CSV with the following commands.

Add-VMNetworkAdapter -ManagementOS -Name "Management" -SwitchName "ConvergedHVSwitch"

Add-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -SwitchName "ConvergedHVSwitch"

Add-VMNetworkAdapter -ManagementOS -Name "CSV" -SwitchName "ConvergedHVSwitch"

10. After creating the virtual network adapters, when opening the Network Connections window in the Management OS, you will see the three networks as shown in the following screenshot.

1485EN_02_04

11. Then, run the following commands to set the minimum bandwidth weigh of 40 for LiveMigration, 5 for CSV and 5 for Management.

Set-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -MinimumBandwidthWeight 40

Set-VMNetworkAdapter -ManagementOS -Name "CSV" -MinimumBandwidthWeight 5

Set-VMNetworkAdapter -ManagementOS -Name "Management" -MinimumBandwidthWeight 5

12. Use the command New-NetIPAddress and Set-DnsClientServerAddress to add the IP, subnet, default gateway and DNS client using the following commands as example.

New-NetIPAddress -InterfaceAlias "vEthernet (Management)" -IPAddress 192.168.1.1 -PrefixLength "24" -DefaultGateway 192.168.1.254

Set-DnsClientServerAddress -InterfaceAlias "vEthernet (Management)" -ServerAddresses 192.168.1.250

13. Run the New-NetIPAddress to add the IP settings to the LiveMigration and CSV network.

14. Repeat steps 1 to 13 in the other server that will be member of the cluster.

15. For every virtual machine, you can now use the virtual switch created in step 8 called ConvergedHVSwitch.

1485EN_02_05

How it works…

For everyone who has created a cluster in Hyper-V in Windows Server 2008 knows that networking is one of the most complicated and sometime expensive settings during a cluster configuration. In a normal scenario, you would have a network interface or a NIC Teaming for the Management OS, CSV, Live Migration and the virtual machines. For high availability with a NIC Teaming for each network, we would have at least eight network adapters.

Thankfully, Windows Server 2012 introduced two features that help you to simplify the networking in a cluster, which are NIC Teaming and Converged Network.

NIC Teaming provides Load Balancing/Failover or LBFO and network aggregation with up to 32 network interfaces using Windows Server 2012, which means you are not dependent of any hardware nor extra costs.

When creating a NIC Teaming in Windows, there are three Teaming modes:

Switch-Independent teaming: This is the most common teaming used, as it doesn’t require the switch that the network adapters are connected to participate in the teaming. This option, which was used in the recipe, can be beneficial when the network adapters are connected into different switches.

Generic or Static Teaming: This option requires both switch and the team to have the same configuration, which is normally supported by server-class switches.

Link Aggregation Control Protocol Teaming or LACP: This option also requires both switch and the team to have the configuration, but it uses a dedicated protocol to identify the links dynamically.

In Windows, there are also three different load balancing mode:

Hyper-V switch port: This option associates a team member to a virtual network adapter using round robin. That said the virtual machine will use the same team member every time it is started. This option would be interesting for large environments and when using Virtual Machine Queues – VMQ as a queue can be in a specific NIC where the traffic is expected.

Address Hashing: This option can be used for TCP and UPD traffic only, which creates a hash and then assign packets with hash value to the available adapter.

Dynamic: Added in Windows Server 2012 R2, the Dynamic algorithm distribute outbound loads on a hash in real time between team members and it also distribute the inbound loads through the Hyper-V port, bringing the best of the two other options together.

The other feature of Windows Server 2012 is Converged Network, which creates a virtual network with virtual network adapters that can be used for different services, such as CSV, Live Migration and the Management OS.

Converged Network is the name given when a virtual switch is created and virtual network adapters are added to it. Then Quality of Service – QoS policies are assigned to each virtual network adapter added to the switch so that you can control how much of the physical network can be used per each virtual network. To make it easier, our scenario had a server with a NIC Teaming that was added to a virtual switch with three virtual network adapters: Management OS using 5% of the bandwidth, CSV with 5% and Live Migration using the other 40%. The remaining 50% would be used by virtual machines.

Converged Networks can be created using PowerShell only and when creating the virtual switch you can use the bandwidth setting as weight or absolute. Weight assigns each virtual network adapter to a share of the available bandwidth. Absolute requires the bandwidth to be specified in bits per second, making this option not as simple as weight.

In this recipe, you have seen how you can use NIC Teaming and Converged Networks to simplify and save costs when configuring the network of your Hyper-V Cluster.

Creating a NIC Teaming using a PowerShell Command Line

The recipe showed how to create a NIC teaming using the graphical interface. Using New-LBFOTeam can help you to create the same NIC Teaming used in this recipe with a simple and small command line.

New-NetLBFOTeam –Name HyperVTeam –TeamMembers NIC01,NIC02 –TeamingMode SwitchIndependent –LoadBalancingAlgorithm Dynamic

Automating the NIC Teaming and Converged Network creation with a PowerShell Script

As demonstrated during the recipe, a couple of commands were used to configure the Converged Network. To help you to automate the process in all other servers that will be member of the cluster, copy the following command to a PowerShell PS1 file and run on each server. Make sure you change the IP addresses for each virtual network adapter based on your needs.

#Create a NIC Team with the network interfaces NIC01 and NIC02 using the teaming mode Switch Independent and the Load Balancing Algorithm set as Dynamic

New-NetLBFOTeam –Name HyperVTeam –TeamMembers NIC01,NIC02 –TeamingMode SwitchIndependent –LoadBalancingAlgorithm Dynamic

#Create a virtual switch called ConvergedHVSwitch using the NIC team created in the previous command and with the bandwidth mode set as weight

New-VMSwitch -Name ConvergedHVSwitch -NetAdapterName HyperVTeam -AllowManagementOS $False -MinimumBandwidthMode Weight

#Commands to create 3 virtual network adapters called Management, LiveMigration and CSV using the virtual switch created in the previous command

Add-VMNetworkAdapter -ManagementOS -Name "Management" -SwitchName "ConvergedHVSwitch"

Add-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -SwitchName "ConvergedHVSwitch"

Add-VMNetworkAdapter -ManagementOS -Name "CSV" -SwitchName "ConvergedHVSwitch"

#Commands to set the Live Migration NIC bandwidth weight of 40, CSV with 5 and Management with 5 as well

Set-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -MinimumBandwidthWeight 40

Set-VMNetworkAdapter -ManagementOS -Name "CSV" -MinimumBandwidthWeight 5

Set-VMNetworkAdapter -ManagementOS -Name "Management" -MinimumBandwidthWeight 5

#Commands to configure IP addresses for the network used by the Management OS (requires different IPs per server)

New-NetIPAddress -InterfaceAlias "vEthernet (Management)" -IPAddress 192.168.1.1 -PrefixLength "24" -DefaultGateway 192.168.1.254

Set-DnsClientServerAddress -InterfaceAlias "vEthernet (Management)" -ServerAddresses 192.168.1.250

#Commands to configure IP addresses for the CSV and LiveMigration networks (requires different IPs per server)

New-NetIPAddress -InterfaceAlias "vEthernet (CSV)" -IPAddress 192.168.1.2 -PrefixLength "24" -DefaultGateway 192.168.1.254

New-NetIPAddress -InterfaceAlias "vEthernet (LiveMigration)" -IPAddress 192.168.1.3 -PrefixLength "24" -DefaultGateway 192.168.1.254

About leandroesc
Leandro Carvalho works as product specialist with Microsoft solutions such as Windows Server, Hyper-V, App-V, VDI, Security, System Center, Exchange, Lync Server, Sharepoint, Project Server and client systems, in addition to helping the community constantly with articles, forums, videos and lectures about his passion: Microsoft Virtualization. He obtained the certifications Certified Ethical Hacker/MCP/MCSA+M+S/MCSE+S/MCTS/MCITP/MCT and MVP. In 2009 he won the MCT Awards Latin America Trainer of the year and since 2009 the Microsoft MVP as a Virtualization Specialist.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: