You can retrieve information about virtual switches by using the vicfg-vswitch command.
Specify one of the options listed in Connection Options for vCLI Host Management Commands in place of <conn_options>
.
- Check whether
vSwitch1
exists.vicfg-vswitch <conn_options> -c vSwitch1
- List all virtual switches and associated port groups.
vicfg-vswitch <conn_options> -l
The command prints information about the virtual switch, which might include its name, number of ports, MTU, port groups, and other information. The default port groups areManagement Network and VM Network
. - Retrieve the current CDP (Cisco Discovery Protocol) setting for this virtual switch.
If CDP is enabled on a virtual switch, ESXi administrators can find out which Cisco switch port is connected to which virtual switch uplink. CDP is a link-level protocol that supports discovery of CDP-aware network hardware at either end of a direct connection. CDP is bit forwarded through switches. CDP is a simple advertisement protocol which beacons information about the switch or host and some port information.
vicfg-vswitch <conn_options> --get-cdp vSwitch1