Adding and Deleting
Virtual Switches with ESXCLI
You can add and
delete virtual switches by using the
esxcli network
vswitch standard
namespace.
Specify one of the options
listed in
Connection Options for vCLI Host Management Commands
in place of
<conn_options>
.
- Add a virtual switch.
You can specify the number of port groups while adding the virtual switch. If you do not specify a value, the default value is used. The system-wide port count cannot be greater than 4096.esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42
After you have added a virtual switch, you can set switch attributes. See Setting Switch Attributes with ESXCLI. You can also add one or more uplink adapters. See Linking and Unlinking Uplink Adapters with ESXCLI.esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42 --ports=8 - Delete a virtual switch.
You cannot delete a virtual switch if any ports on the switch are still in use by VMkernel networks or virtual machines. Runesxcli <conn_options> network vswitch standard remove --vswitch-name=vSwitch42esxcli network vswitch standard listto determine whether a virtual switch is in use.