VMkernel network interfaces provide the network access for the VMkernel TCP/IP stack. You must create new VMkernel ports for your ESXi system if you plan on using VMotion, VMware FT, or iSCSI and NAS storage. A VMkernel port consists of a port on the virtual switch and a VMkernel interface.

To add a VMkernel Network Interface to your ESXi system, use the following steps.

1

Create a HostVirtualNicSpec data object. Inside the object, you can specify the IP configuration in a HostIpConfig data object. For vSS, specify the portgroup property. For vDS, specify the distributedVirtualPort property.

2

Call HostNetworkSystem.AddVirtualNic, passing in the HostVirtualNicSpec.

3

You can then use the VMkernel network interface for software iSCSI or NAS, or call the HostVmotionSystem.SelectVnic method to use this VMkernel NIC for VMotion.

Example: Adding a VMkernel Network Interface, a code fragment from the AddVirtualNic example, illustrates this. The sample retrieves the IP address from the command line using the cb.get_option call.

private HostVirtualNicSpec createVNicSpecification() {
     HostVirtualNicSpec vNicSpec = new HostVirtualNicSpec();
     HostIpConfig ipConfig = new HostIpConfig();
     ipConfig.setDhcp(false);
     ipAddr = cb.get_option("ipaddress");
     ipConfig.setIpAddress(ipAddr);
     ipConfig.setSubnetMask("255.255.255.0");
     vNicSpec.setIp(ipConfig);
     return vNicSpec;
}
     ....
     
HostVirtualNicSpec vNicSpec = createVNicSpecification();
service.addVirtualNic(nwSystem, portGroup, vNicSpec);