用Powershell实现网卡捆绑(NIC Teaming)

NIC Teaming又称网卡捆绑,是Windows Server 2012一个很简单实用的功能。

本篇将介绍如何用Powershell在Server Core的环境下实现网卡捆绑(NIC Teaming)。

背景:

如何你使用Windows Server 2012作为集群的服务器,你势必要用到Windows Server 2012 Core,因为Core本身很轻便,没有多余的包运行。

因此如果使用Server Core会让服务器更专注于他自己的职责。

操作方法:

1. Get-NetAdapter

获取网卡信息,记住网卡的名称,因为你要在之后的部署中使用到。

2. New-NetLbfoTeam “NIC TEAMING” -teamingMode Static

3. 随后分别输入Teammember名称

4. Set-NetLbTeam NIC TEAMING -LoadBalancingAlgorithm HyperVPorts

这里需要注意的一点,如果你调试的Server是用于虚拟机的使用,那么你需要将其设置为HyperV。否则将不会工作。

5. 设置 VLan 20

Add-NetLbfoTeamNIC NIC TEAMING 20

在操作期间如果发现不明白的地方可以利用 Get-Command -Module NetLbfo来查看Module命令行。

如果想查看命令的用法,可以通过Get-Help New-NetLbfoTeam

6. 当然你也需要调试你的port-channel

在Switch中调试:
interface Port-channel1
description LAN for Clauster
switchport
switchport access vlan 11
switchport trunk encapsulation dot1q
switchport mode trunk
spanning-tree portfast

 

在端口调试:
description Clauster Lan
switchport access vlan 11
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 5 mode on
spanning-tree portfast
spanning-tree bpduguard enable