Distributed Virtual Switch Configuration

To use a distributed virtual switch, you create a switch and portgroups on a vCenter Server, and add hosts as members of the switch.
  1. Use the
    Folder.CreateDVS_Task
    method to create a distributed virtual switch. Use a
    DVSConfigSpec
    to create a switch for a third-party implementation. Use a
    VMwareDVSConfigSpec
    to create a VMware distributed virtual switch.
  2. Use the
    CreateDVPortgroup_Task
    method to create portgroups for host and virtual machine network connections and for the connection between proxy switches and physical NICs. A
    DistributedVirtualPortgroup
    specifies how virtual ports (
    DistributedVirtualPort
    ) will be used. When you create a distributed virtual switch, the vCenter Server automatically creates one uplink portgroup (
    config.uplinkPortgroup
    ). Uplink portgroups are distributed virtual portgroups that support the connection between proxy switches and physical NICs.
    Port creation on a distributed switch is determined by the portgroup type (
    DVPortgroupConfigSpec.type
    ):
    • If a portgroup is early binding (static), then
      DVPortgroupConfigSpec.numPorts
      determines the number of ports that get created when the portgroup is created. This number can be increased if
      DVPortgroupConfigSpec.autoExpand
      is true.
    • If a portgroup is ephemeral (dynamic), then
      numPorts
      is ignored and ports are created as needed.
      You can also specify standalone ports that are not associated with a port group and uplink ports that are created on ESXi hosts (
      DVSConfigSpec.numStandalonePorts
      ).
      The
      DVPortgroupConfigInfo.numPorts
      property is the total number of ports for a distributed virtual switch. This total includes the ports generated by the static and dynamic portgroups and the standalone ports.
  3. If you have created additional uplink portgroups, use the
    ReconfigureDvs_Task
    method to add the portgroup(s) to the
    DVSConfigSpec.uplinkPortgroup
    array.
  4. Retrieve physical NIC device names from the host (
    HostSystem.config.network.pnic[].device
    ).
  5. Add host member(s) to the distributed virtual switch. To configure host members:
    • Specify hosts (
      DVSConfigSpec.host[]
      ).
    • For each host, specify one or more physical NIC device names to identify the pNIC(s) for the host proxy connection to the network (
      DistributedVirtualSwitchHostMemberConfigSpec.backing.pnicSpec[].pnicDevice
      )
    • Use the
      DistributedVirtualSwitch.ReconfigureDvs_Task
      method to update the switch configuration.
      When you add a host to a distributed virtual switch (
      DistributedVirtualSwitch.config.host
      ), the host automatically creates a proxy switch. The proxy switch is removed automatically when the host is removed from the distributed virtual switch.
  6. Connect hosts and virtual machines to the distributed virtual switch.
    Host connection
    Specify port or portgroup connections in the host virtual NIC spec (
    HostVirtualNicSpec.distributedVirtualPort
    or
    HostVirtualNicSpec.portgroup
    ).
    Virtual machine connection
    Specify port or portgroup connections in the distributed virtual port backing (
    VirtualEthernetCardDistributedVirtualPortBackingInfo
    ) for the virtual Ethernet cards on the virtual machine (
    VirtualEthernetCard.backing
    ).