Friday, September 22, 2017

How to remove vnic from DVS on ESX without VC!

While moving from normal port group to a DVS, we faced an issue with vCenter. The vCenter lost its IP address and we had no option but to remove the vnic that was added to a DVS, back to normal port group.
But how to do you do this without vCenter?!

Thankfully, there are some command lines available.

Here are the steps:

1. Identify the vnmic#, Dswitch name and dvport id using following command

[root@w2-nsbu-systest-esx050:~] esxcli network vswitch dvs vmware list
DSwitch_VM_Network
   Name: DSwitch_VM_Network
   VDS ID: 50 3a a0 2c 2c 55 5e c0-77 20 4d 17 f9 b5 ee 10
   Class: etherswitch
   Num Ports: 8192
   Used Ports: 4
   Configured Ports: 512
   MTU: 1500
   CDP Status: listen
   Beacon Timeout: -1
   Uplinks: vmnic3
   VMware Branded: true
   DVPort:
         Client: vmnic3
         DVPortgroup ID: dvportgroup-60
         In Use: true
         Port ID: 59

         Client:
         DVPortgroup ID: dvportgroup-60
         In Use: false

         Port ID: 60

2. Remove the vnic using following command:

[root@w2-nsbu-systest-esx050:~] esxcfg-vswitch -Q vmnic3 -V 59 DSwitch_VM_Network

Voila! vmnic3 in this case is disconnected from DSwitch_VM_Network. You can now associate this with a normal port group.