VMware Cloud Community
ErikJurgensmeie
Contributor
Contributor
Jump to solution

Adding a NIC to the Management/Console Network

I'm pretty new to vitoolkit and powershell but I'm trying to assign a second physical NIC to the Management/Console network via vitoolkit/powershell. I've tried a few things including a couple of samples below:

connect-viserver -server $HostFQDN

$nics = "vmnic0","vmnic3"

Set-VirtualSwitch -VirtualSwitch vSwitch0 -Nic $nics

or

connect-viserver -server $HostFQDN

$nics = "vmnic0","vmnic3"

$vs = Get-VirtualSwitch | Where-Object { $_.Name -eq "vSwitch0"}

Set-VirtualSwitch -VirtualSwitch $vs -Nic $nics

Where vmnic0 is the existing physical nic assigned to the console network and vmnic3 is the one i'm trying to add. I keep hitting errors so I'm definitely missing something. Could someone point me in the right direction?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Smitty_Smith
Enthusiast
Enthusiast
Jump to solution

Try this:

  1. Connect to a VirtualCenter instance

$VC = Connect-VIServer -Server someserver

Write-Host `n"Connected to VirtualCenter $VCHost"`n

  1. Add 2nd NIC to Management vSwitch

$vs = get-virtualswitch -vmhost someserver -name vSwitch0

Set-VirtualSwitch -VirtualSwitch $vs -Nic vmnic3

Write-Host `n"Added 2nd NIC to Console Switch"

If there is already a nic added, say vmnic0 and you try to add it again, it will fail. By default the install should have added vmnic0 to the management switch already. All you need to do is add the missing nic only.

View solution in original post

0 Kudos
3 Replies
Smitty_Smith
Enthusiast
Enthusiast
Jump to solution

Try this:

  1. Connect to a VirtualCenter instance

$VC = Connect-VIServer -Server someserver

Write-Host `n"Connected to VirtualCenter $VCHost"`n

  1. Add 2nd NIC to Management vSwitch

$vs = get-virtualswitch -vmhost someserver -name vSwitch0

Set-VirtualSwitch -VirtualSwitch $vs -Nic vmnic3

Write-Host `n"Added 2nd NIC to Console Switch"

If there is already a nic added, say vmnic0 and you try to add it again, it will fail. By default the install should have added vmnic0 to the management switch already. All you need to do is add the missing nic only.

0 Kudos
ErikJurgensmeie
Contributor
Contributor
Jump to solution

Looks like my problem was (as you pointed out) that I was attempting to set vmnic0 and vmnic3 with the Set-VirtualSwitch command and erroring out because vmnic0 was already set. In my head I was thinking that Set-VirtualSwitch would overwrite the existing NIC config not just add to it and the obscure error I was receiving didn't help. I was able to use my original code and yours to add vmnic3 if I removed the existing vmnic0 from my code.

Thanks for your help!

0 Kudos
drwoodberry
Contributor
Contributor
Jump to solution

I tried the above code, and when I do this, it disconnects the esxi host and does not run. All I want to do is add the second physical host nic to the exsisting vswitch. I can add it from vCenter with no issues, but when I try to script it like in this thread, it disconnects. Any help would be great.

0 Kudos