Teaming network adapters, or NICs, is a great way of providing load-balancing and failover capabilities for mission critical services. Windows Server 2012 allows up to 32 network adapters in a single team. You can create a team in the graphical server manager, or through PowerShell, which is very useful if you are automating server build or configurations.

In Windows Server 2012, we’ll use the NetLBFO module. You can also manage the team remotely from a Windows 8 computer that has Remote Server Administration Tools (RSAT) installed. For the sake of simplicity I’ll create a new team on a Windows Server 2012 system. When you look at help for the cmdlets I’m using, which you should, if you wanted to do this remotely you would use the CimSession parameter.

Creating a new team ^

To create a new team you should have similar, if not identical network adapters. You will need to know the names of your adapters as they are displayed in Control Panel\Network and Internet\Network Connections. You will want to decide what load balancing algorithm to use.

  • TransportPorts: Assign traffic to an interface based on a hash of source and destination TCP ports and the IP addresses.
  • IPAddresses: Assign traffic to an interface based on a hash of the source and destination IP addresses.
  • MacAddresses: Assign traffic to an interface based on a hash of source and destination MAC addresses.
  • HyperVPort: Distributes network traffic based on the source virtual machine Hyper-V switch port identifier. This only makes sense if configuring within a VM.

The default value is TransportPorts. You’ll also want to consider the TeamingMode:

  • LACP: Uses the IEEE 802.1ax Link Aggregation Control Protocol (LACP) to dynamically identify links that are connected between the host and a given switch. (This protocol was formerly known as IEEE 802.3ad draft)
  • Static: Requires configuration on both the switch and the host to identify which links form the team.
  • SwitchIndependent: Specifies that a network switch configuration is not needed for the NIC team. When configuring teaming within a Hyper-V virtual machine, you must select this choice. This is also the default.

Once you’ve made your decisions, creating the team is really quite simple.

PS C:\> $teamA = New-NetLbfoTeam -Name TeamA -TeamMembers "Ethernet 2","Ethernet 3" -TeamingMode SwitchIndependent

PS C:\> $teama

Name                   : TeamA
Members                : {Ethernet 2, Ethernet 3}
TeamNics               : TeamA
TeamingMode            : SwitchIndependent
LoadBalancingAlgorithm : TransportPorts
Status                 : Up

The new team shows up as a new adapter

The new team shows up as a new adapter.

I can also retrieve the team with PowerShell.

PS C:\> get-netlbfoteam
Name                   : TeamA
Members                : {Ethernet 2, Ethernet 3}
TeamNics               : TeamA
TeamingMode            : SwitchIndependent
LoadBalancingAlgorithm : TransportPorts
Status                 : Up

Configuring the Team ^

The new team will pick up an IP address from DHCP. You can manually set it through Control Panel, or assign settings with PowerShell. First, I’ll verify I can even find the new team.

PS C:\> get-netlbfoteam
Name                   : TeamA
Members                : {Ethernet 2, Ethernet 3}
TeamNics               : TeamA
TeamingMode            : SwitchIndependent
LoadBalancingAlgorithm : TransportPorts
Status                 : Up

View the NIC Team with PowerShell

View the NIC Team with PowerShell

Good. This means I can pipe this to Set-NetAdapter and configure its IP address. First, I’ll delete the existing IPV4 address, confirming the action when prompted.

PS C:\> get-netadapter teama | get-netipaddress –addressfamily ipv4 | remove-netipaddress

Then I can define a new address.

PS C:\> get-netadapter teama | New-NetIPAddress -IPAddress '172.16.30.203' -AddressFamily IPv4 -PrefixLength 16 –defaultgateway '172.16.10.254'

Define new IP address

Define new IP address

At this point, all that remains is to set DNS.

PS C:\> Get-NetAdapter teama | Set-DnsClientServerAddress -ServerAddresses '172.16.30.200','172.16.30.203'

The team is now ready for business.

Summary ^

Configuring a network team with PowerShell only takes a little practice to understand how the cmdlets work. If anything, creating the team is the easy part. Configuring IP settings is sometimes a bit more complicated. But now if you are considering automating server deployments, this is a great tool to add to your kit.

Also read: How to create NIC Team in Server Manager

avatar
2 Comments
  1. joh deheugden 3 years ago

    nice tutorial. I cant add the dns when adding the ip-address through powershell in one code?

  2. Rob 2 years ago

    default policy on the server is set to dhcp on interfaces. How to turn off this policy to allow setting up static IP address on newly created team interface (windows 2016 core and hyper-v server 2016)

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2021

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account