6.5

Table Of Contents
Adding and Deleting Virtual Switches
You can add and delete virtual switches with ESXCLI and with vicfg-vswitch.
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,” on
page 19 in place of <conn_options>.
n
Add a virtual switch.
esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42
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 --ports=8
After you have added a virtual switch, you can set switch aributes. See “Seing Switch Aributes with
ESXCLI,” on page 138. You can also add one or more uplink adapters. See “Linking and Unlinking
Uplink Adapters with ESXCLI,” on page 144.
n
Delete a virtual switch.
esxcli <conn_options> network vswitch standard remove --vswitch-name=vSwitch42
You cannot delete a virtual switch if any ports on the switch are still in use by VMkernel networks or
virtual machines. Run esxcli network vswitch standard list to determine whether a virtual switch is
in use.
Adding and Deleting Virtual Switches with vicfg-vswitch
You can add and delete virtual switches by using the --add|-a and --delete|-d options.
Specify one of the options listed in “Connection Options for vCLI Host Management Commands,” on
page 19 in place of <conn_options>.
n
Add a virtual switch.
vicfg-vswitch <conn_options> --add vSwitch2
After you have added a virtual switch, you can set switch aributes. See “Seing Switch Aributes with
vicfg-vswitch,” on page 139. You can also add one or more uplink adapters. See “Linking and
Unlinking Uplink Adapters with vicfg-vswitch,” on page 144.
n
Delete a virtual switch.
vicfg-vswitch <conn_options> --delete vSwitch1
You cannot delete a virtual switch if any ports on the switch are still in use by VMkernel networks,
virtual machines, or vswifs. Run vicfg-vswitch --list to determine whether a virtual switch is in use.
Setting Switch Attributes with ESXCLI
You can set the maximum transmission unit (MTU) and CDP status for a virtual switch. The CDP status
shows which Cisco switch port is connected to which uplink.
Specify one of the options listed in “Connection Options for vCLI Host Management Commands,” on
page 19 in place of <conn_options>.
n
Set the MTU for a vSwitch.
esxcli <conn_options> network vswitch standard set --mtu=9000 --vswitch-name=vSwitch1
vSphere Command-Line Interface Concepts and Examples
138 VMware, Inc.