I have been trying to setup a lab configuration to test Failover cluster in Windows Server 2012 R2. In this process i was trying to follow the best practices available on various posts, while trying to achieve the minimum configuration to be able to test this and other features of Microsoft’s latest server incarnation.
And since it took a few attempts to get it right (great learning experience), one of the more tedious part was reconfiguring the network setup. Both servers have 4x1Gb network cards, so i decided to dedicate 2 to storage (iSCSI) traffic and the other 2 ports to cluster traffic. Part of the solution is to setup the NIC teaming and configure all the vNICs as well.
In may case i also had the on-board nic that i used for management, but with this script, removing some of the commented lines, it would be fairly straightforward to setup a vNIC for management as well.
# This Script creates the network configuration for use with 4 x NICs, creating 2 NIC Teams, # one for storage and one for cluster communication # The 4 NICs need to be named as follows: # 1. StorageNIC1 # 2. StorageNIC2 # 3. ClusterNIC1 # 4. ClusterNIC2 # IMPORTANT - update the IP addresses in the script for each node accordingly #Create Storage NIC Team New-NetLbfoTeam -Name StorageTeam -TeamMembers StorageNIC1,StorageNIC2 -LoadBalancingAlgorithm Dynamic -TeamingMode LACP #Create Virtual Switch New-VMSwitch -Name StorageSwitch -NetAdapterName StorageTeam -AllowManagementOS $False -MinimumBandwidthMode Weight #Set Default minimum bandwith Set-VMSwitch "StorageSwitch" -DefaultFlowMinimumBandwidthWeight 50 #Create vNICs for host iSCSI Add-VMNetworkAdapter -ManagementOS -Name "iSCSI1" -SwitchName "StorageSwitch" Add-VMNetworkAdapter -ManagementOS -Name "iSCSI2" -SwitchName "StorageSwitch" #Configure VLAN IDs Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "iSCSI1" -Access -VlanId 100 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "iSCSI2" -Access -VlanId 100 #Set QoS Policies Set-VMNetworkAdapter -ManagementOS -Name "iSCSI1" -MinimumBandwidthWeight 25 Set-VMNetworkAdapter -ManagementOS -Name "iSCSI2" -MinimumBandwidthWeight 25 #Rename Network Adapters Get-NetAdapter -Name "vEthernet (iSCSI1)" | Rename-NetAdapter -NewName iSCSI1 Get-NetAdapter -Name "vEthernet (iSCSI2)" | Rename-NetAdapter -NewName iSCSI2 #Set IP addresses New-NetIPAddress -InterfaceAlias "iSCSI1" -IPAddress 192.168.101.11 -PrefixLength "24" New-NetIPAddress -InterfaceAlias "iSCSI2" -IPAddress 192.168.102.11 -PrefixLength "24" #Create Cluster NIC team New-NetLbfoTeam -Name ClusterTeam -TeamMembers ClusterNIC1,ClusterNIC2 -LoadBalancingAlgorithm HyperVPort -TeamingMode SwitchIndependent #Create Virtual Switch New-VMSwitch -Name ClusterSwitch -NetAdapterName ClusterTeam -AllowManagementOS $False -MinimumBandwidthMode Weight #Set Default minimum bandwidth Set-VMSwitch "ClusterSwitch" -DefaultFlowMinimumBandwidthWeight 50 #Create vNICs for cluster communication #optional - management vNIC, remove comment from next line if no dedicated NIC for management is available #Add-VMNetworkAdapter -ManagementOS -Name "Management" -SwitchName "ClusterSwitch" Add-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -SwitchName "ClusterSwitch" Add-VMNetworkAdapter -ManagementOS -Name "CSV" -SwitchName "ClusterSwitch" #Configure VLAN IDs #Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "Management" -Access -VlanId 1 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "LiveMigration" -Access -VlanId 101 Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName "CSV" -Access -VlanId 102 #Set QoS Policies - ADJUST the numbers so that Default(Minimum) + LiveMigration + CSV (+ Management) = 100 #Set-VMNetworkAdapter -ManagementOS -Name "Management" -MinimumBandwidthWeight 5 Set-VMNetworkAdapter -ManagementOS -Name "LiveMigration" -MinimumBandwidthWeight 40 Set-VMNetworkAdapter -ManagementOS -Name "CSV" -MinimumBandwidthWeight 10 #Rename Network Adapters #Get-NetAdapter -Name "vEthernet (Management)" | Rename-NetAdapter -NewName Management Get-NetAdapter -Name "vEthernet (LiveMigration)" | Rename-NetAdapter -NewName LiveMigration Get-NetAdapter -Name "vEthernet (CSV)" | Rename-NetAdapter -NewName CSV #Set IP addresses #New-NetIPAddress -InterfaceAlias "Management" -IPAddress 192.168.100.51 -PrefixLength "24" -DefaultGateway 192.168.100.254 #Set-DnsClientServerAddress -InterfaceAlias "Management" -ServerAddresses 184.108.40.206 New-NetIPAddress -InterfaceAlias "LiveMigration" -IPAddress 192.168.103.11 -PrefixLength "24" New-NetIPAddress -InterfaceAlias "CSV" -IPAddress 192.168.104.11 -PrefixLength "24"