VMware ESX/ESXi command line reference on vDS Distributed Switch and vSwitch

Remove a PHY NIC from an UpLink in a vDS at the command line:

esxcfg-vswitch --list : Create a listing needed to get the reference for a vmnic's PortID#.

esxcfg-vswitch -V <vmnics PortID#> -Q <vmnic> <NAME of virtual Distributed Switch as it appears in vCenter inventory>

# esxcfg-vswitch -V 577 -Q vmnic1 NET2-N1K-VDS

Delete a Physical NIC from a standard virtual Switch on a Host:

esxcfg-vswitch –U vmnic<0-9> vSwitch<0-9>

Adding NIC to a standard virtual Switch on a Host:

#esxcfg-vswitch -L vmnic<0-9> vSwitch<0-9>

Add an uplink to a particular port group under a vSwitch:

#esxcfg-vswitch -M vmnic<0-9> vswitch<0-9> -p PortGroup<0-9>

Delete a PortGroup from a standard vSwitch:

esxcfg-vswitch -D <PortGroup Name(from a listing or vCenter)> vSwitch<0-9>

Delete a vmk(vmkernel) from a PortGroup on any type of switch:

esxcfg-vmknic –d –p <PortGroup Name>

Delete a standard virtual Switch on a Host (Note: All Port Groups have to be removed):

esxcfg-vswitch –delete vSwitch<0-9>


Migrate a vmk Management Port on a vDS to a standard vSwitch :

  1. Find the DVportID of the vmk0
    esxcfg-vswitch -l | grep vmk0  (Take note of DVPortID for vmk0)
  2. Delete vmk0 from vDS
     esxcfg-vmknic --del vmk0 --dvport-id <DVPortID> --dvs-name <vDS Name as in vCenter>
  3. Create new virtual switch if needed:
    esxcfg-vswitch --add vSwitch0
  4. Create 'Management Network' portgroup on original vSwitch
    esxcfg-vswitch --add-pg 'Management Network' vSwitch0
  5. Add VLAN to vSwitch0
    esxcfg-vswitch --pg 'Management Network' --vlan <vlan id> vSwitch0
  6. Add vmknic back to 'Management Network' portgroup
    esxcfg-vmknic -a -i <Management IP address> -n <netmask> --portgroup 'Management Network