You configure network settings so that a virtual machine can communicate with the host and with other virtual machines. When you configure a virtual machine, you can add network adapters (NICs) and specify the adapter type.

You can add virtual Ethernet adapters to a virtual machine by using the VMTypes.CreateSpec.setNics method. Pass as argument a List of EthernetTypes.CreateSpec objects that provide the configuration information of the created virtual Ethernet adapters. You can set the MAC address type to EthernetTypes.MacAddressType.MANUAL, EthernetTypes.MacAddressType.GENERATED, or EthernetTypes.MacAddressType.ASSIGNED. Select MANUAL to specify the MAC address explicitly.

You can specify also the physical resources that back a virtual Ethernet adapter by using the EthernetTypes.BackingSpec.setType method. The method takes as argument one of the following types: EthernetTypes.BackingType.STANDARD_PORTGROUP, HOST_DEVICE, DISTRIBUTED_PORTGROUP, or OPAQUE_NETWORK.