Using Command Line Tools to Configure Appropriate vDS Settings

Whilst distributed switches are mostly configured through vCenter, there are a number of commands that can be used via an ESXi host’s CLI to display and alter vDS configuration (although these are limited to adding and removing uplinks). I’ve written about configuring host networking using esxcli here, so will focus on the esxcfg-* commands in this post.

To view information on the all the vSwitches on a given host you can use:


# esxcfg-vswitch -l

DVS Name         Num Ports   Used Ports  Configured Ports  MTU     Uplinks
dvSwitch         256         3           256               1500    vmnic9,vmnic8

  DVPort ID           In Use      Client
  0                   1           vmnic8
  1                   1           vmnic9

The esxcfg-vswitch commands relating directly to operations on a dvSwitch are:


 -P|--add-dvp-uplink=uplink  Add an uplink to a DVPort on a DVSwitch.
                              Must specify DVPort Id.
  -Q|--del-dvp-uplink=uplink  Delete an uplink from a  DVPort on a DVSwitch.
                              Must specify DVPort Id.
  -V|--dvp=dvport             Specify a DVPort Id for the operation.

The output above shows that vmnic8 and vmnic9 are being used as uplinks on the dvSwitch. If we wanted to remove vmnic9 from the switch we could run:


# esxcfg-vswitch -Q vmnic9 -V 1 dvSwitch

Listing the host’s vSwitche’s now shows that vmnic9 isn’t being used as an uplink on the dvSwitch:


# esxcfg-vswitch -l
DVS Name         Num Ports   Used Ports  Configured Ports  MTU     Uplinks
dvSwitch         256         2           256               1500    vmnic8

  DVPort ID           In Use      Client
  0                   1           vmnic8
  1                   0

To add vmnic9 back as an uplink, run:


# esxcfg-vswitch -P vmnic9 -V 1 dvSwitch

Listing the vSwitches again shows that vmnic9 is now being used as an uplink on the dvSwitch once again:


# esxcfg-vswitch -l
DVS Name         Num Ports   Used Ports  Configured Ports  MTU     Uplinks
dvSwitch         256         3           256               1500    vmnic9,vmnic8

  DVPort ID           In Use      Client
  0                   1           vmnic8
  1                   1           vmnic9

Related posts

VMware vSphere Virtual Machine Snapshots Explained

How to Enable SSH on All ESXi Hosts using PowerCLI

How to Install VMware Tools on Debian 11

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More