Managing NIC Team using powershell

In this article, we will cover additional commands that can expand both our experience with PS and the NIC team in a functional way. In previous article, we covered the basic commands for the NIC teaming.

Most readers will be satisfied only with the basic commands. You may execute just two commands to create the team in a minute. Alas, sometimes we need to do more, like to replace the NIC in the team. This article can help you in such situations.

For those readers who feel more comfortable with the GUI tools, I already published two articles related to the local GUI and remote management. Actually, this and the previous article reveal the background process of the GUI tools.

I got inspiration for same parts of this article from my friend Luka Manojlovic and his excellent presentation about Hyper-V servers, which he gave on the MS Sinergija 2016 conference in Belgrade, Serbia.

For you convenience, I uploaded the single file with all commands mentioned in this and the previous article. You’re free to download it and use it for your own education and work.

 

Renaming the team

We created a new team on one server and gave it some name, like LAN. After a while, we created the second team on another server and gave it the different name, like Office. One day, we decided to use the same name for all teams with the same function (e.g. the LAN connection) on all servers.

We need the command for this task – Rename-NetLbfoTeam. You just need to specify the old and new names.

Rename-NetLbfoTeam -Name LAN -NewName Team01

The command will not display the output, but we can check it with the command Get-NetLbfoTeam.

clip_image001

Don’t worry for the degraded status. It will take a few seconds to reconnect all NICs and the team.

Before we proceed to other interesting commands, I would like to show you that you could see all network adapters in the system. We have three adapters now – two NICs and one team adapter (i.e. virtual NIC or vNIC).

09 - Get-NetAdapter with team

 

Adding a new vNIC to team

Our team has only one vNIC. One property of this adapter is the VLAN tag. In most cases, we don’t need to set it. Even if the server needs to be associated with the specific VLAN, we may administer it on the network switch.

Nevertheless, we may have to allow to our server to communicate through the specific VLAN. We can do that very simply; just add a new vNIC with the specific VLAN id.

VMs don’t need this vNIC, as we should setup the VLAN tag as the part of the configuration of their network connection. This vNIC is purely for the host itself – very useful feature for the clusters.

Let we assume that we need the new vNIC in the VLAN 5. The command will be:

Add-NetLbfoTeamNic -Team Team01 -VlanID 5 -Name VLAN5

We need to specify at least the team, VLAN id and the name for the vNIC.

clip_image004

If we check our team now, we can see two associated vNICs.

clip_image005

We can also list all network adapters in the system. Now we have four adapters – two NICs and two vNICs associated with the team.

12 - Get-NetAdapter with two team vNICs

 

Removing the vNIC

We don’t need some vNIC and we want to remove it. The command is:

Remove-NetLbfoTeamNic -Team Team01 -VlanID 5

It’s enough to specify only the team name and VLAN id. Of course, we have to confirm that we want to delete this vNIC from the system.

13 - Remove-NetLbfoTeamNic

Our team again has only one virtual NIC.

 

Linking NICs and teams

We will need sometimes to add a new NIC to the existing team, either to expand its bandwidth or to replace the faulty NIC. We can do that in a second.

First, let we assume that we have a problem with one NIC and we want to remove it from the team. We will use the command Remove-NetLbfoTeamMember and specify the NIC’s name and team.

Remove-NetLbfoTeamMember -Name Ethernet -Team Team01

We need to confirm this operation. The answer Yes is the default, so you can just press the ENTER key.

clip_image009

We should check again the team status with the command Get-NetLbfoTeam. As you can see, now only one NIC is the member of team. The team will still operates with the same IP address; only its bandwidth will be decreased.

We just replaced this defective NIC in the system. We want to associate this new NIC with the existing team. The command is similar to the previous – Add-NetLbfoTeamMember.

Add-NetLbfoTeamMember -Name Ethernet -Team Team01

Again, we need to specify the team’s and NIC’s name. Additionally, we need to confirm this change in the system.

15 - Add-NetLbfoTeamMember

Our new NIC is associated with the team. The system will take a few seconds to change the NIC binding and to make it to be a working part of the team.

If you don’t know the name of this new NIC you can use the command Get-NetAdapter, explained on the beginning of the previous article.

 

Do it the powershell way

In this and the previous article, I guide you through the PS commands for the NIC teaming. I show you that all commands are there, mighty and ready to be used.

In most cases, you will just need to create the team and it will works fine for years. For those rare moments when something should be changed or fixed, you will need a few more commands and tricks. These tricks are explained here.

Download this example file with all commands from this and previous article; and use it to practice in your lab.

Stay tuned.

Advertisements

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