■
■
■
■ Configuring a physical adapter (pnic), the actual connection from the host to the network. You can configure the pnic through the HostNetworkSystem.pnic property, which is a PhysicalNic data object. You can specify the set of pnics associated with a virtual switch through the VirtualSwitch.pnic property, which takes an array of physical network adapters.
■ HostNetworkSystem – Managed object that represents the host’s networking configuration. This object’s properties point to the networking data objects you can use for network management, including HostDnsConfig and HostIpRouteConfig.HostNetworkSystem properties allow you to acess HostNetCapabilities and HostNetworkInfo data objects, and access and modify the HostNetworkConfig data object.HostNetworkSystem includes methods for retrieving and changing the network configuration. See the API Reference for a complete list of methods and the permissions required to run them.
■ HostNetworkConfig – Allows you to specify the network configuration for the host. You can apply the configuration by running the HostNetworkSystem.UpdateNetworkConfig method.
■ Network – Represents a network accessible by either hosts or virtual machines. This can be a physical network or a logical network, such as a VLAN.When you add a host to a vCenter Server system, or when you add a virtual machine to an ESX/ESXi host, a Network is added automatically.
■ HostSystem.QueryHostConnectionInfo and Datacenter.QueryConnectionInfo both return a HostConnectInfo data object, which describes the current network configuration.HostSNMPSystem – Supports SNMP setup. See Setting Up SNMP.A vNetwork Standard Switch (vSS) can route traffic internally between virtual machines and can link virtual machines to external networks. vSS Environment shows the elements of a vSS environment.You can use the HostNetworkSystem managed object to access and manipulate the elements of an ESX/ESXi system’s network.
■ The properties of the HostNetworkConfig object, which you access through HostNetworkSystem.networkConfig, allow you to retrieve configuration information. This information is comprehensive and includes the physical adapters, virtual switches, virtual network interfaces, and so on.You can also use HostNetworkConfig to make changes to the configuration.
■ The properties of the HostNetworkInfo object, which you access through HostNetworkSystem.networkInfo, allow you to retrieve runtime information.You call the HostNetworkSystem.AddVirtualSwitch method to add one or more virtual switches. Pass in the name of the virtual switch and a HostVirtualSwitchSpec data object as parameters.Inside HostVirtualSwitchSpec you can specify the MTU, number of ports, network policy, and bridge specification. The bridge specifies how the virtual switch connects to the physical adapter. The currently supported bond bridge provides network adapter (NIC) teaming capabilities through the use of a list of physical devices and, optionally, a beacon probe to test connectivity with physical adapters.You can use a property collector to retrieve the HostNetworkSystem managed object and several of its properties, such as networkInfo.
2 Define a HostVirtualSwitchSpec that specifies the attributes of the virtual switch. You can specify the number of ports (56 to 4088 on ESXi systems) and the HostNetworkPolicy. See Defining the Host Network Policies.
3 Call HostNetworkSystem.AddVirtualSwitch to add a virtual switch. Specify a unique name and a HostVirtualSwitchSpec that defines the switch attributes.The following fragment from AddVirtualSwitch.java illustrates this.Example: Adding a Virtual SwitchPort groups allow you to differentiate between different kinds of traffic passing through a virtual switch. You can also use port groups as a boundary for communication or for security policy configuration. For ESXi systems, the default port groups are Management Network and VM Network. For ESX systems, the default port groups are Service console and VM Network.
1 Define a HostPortgroupSpec. For each port group, you can specify the network policy, the VLAN ID, and the virtual switch to which the port group belongs.
2
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
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.Example: Adding a VMkernel Network InterfaceWhen you configure host networks, you can define specific policies for the network. The HostNetworkPolicy data object type describes network policies for both virtual switches and port groups. If the settings are not specified for the port group explicitly, the port group inherits policy settings from the virtual switch with which it is associated.The policies are defined by the following data objects available as properties of HostNetworkPolicy.
■ HostNicTeamingPolicy – Defines the connection to the physical network. This includes failure criteria, active and standby NICs, and failover and load balancing information. See NIC Teaming.
■ HostNetworkSecurityPolicy – Defines the security policies for the network. See the ESXi Configuration Guide.
■ HostNetworkTrafficShapingPolicy – Establishes parameters for three traffic characteristics: average bandwidth, peak bandwidth, and maximum burst size.You can also specify the VLAN policy by assigning an integer to the HostPortgroupSpec.vlanid property. The VMkernel takes care of tagging and untagging the packets as they pass through the virtual switch. See the HostPortgroupSpec and HostNetworkPolicy data objects in the API Reference.If you specify NIC teaming for a virtual switch, the HostVirtualSwitchSpec.bridge property must be set to HostVirtualSwitchBondBridge.You can set up IPv6 networking for a host by changing the HostIpConfig.ipV6Config property, which is a HostIpConfigIpV6AddressConfiguration data object. HostIpConfigIpV6AddressConfiguration allows you to specify whether auto-configuration is enabled, whether DHCP for ipV6 addresses is enabled, and an array of IPv6 addresses (HostIpConfigIpV6Address data objects).HostIpConfigIpV6Address allows you to specify all aspects of the IPv6 address including the state of the address, the address (unless DHCP is enabled), life time, operation, origin, and prefix length. See the API Reference. The following code fragment illustrates setting the VMkernel NIC to get an automatic IPv6 address from router advertisements and through DHCP. The user provides the IP address on the command line when calling the program from which the fragment is taken. The sample retrieves the address using the cb.get_option utility applications call.Example: IPv6 SetupYou can set up network services for your ESXi system by using HostConfigManager properties and methods.The HostConfigManager.dateTimeSystem property contains a HostDateTimeSystem data object. This object allows you to perform NTP and date and time related configuration.
■
■ Modify the HostDateTimeSystem.dateTimeInfo property, which contains a HostDateTimeInfo object, to set up NTP. The NTP information is stored in the HostDateTimeInfo.ntpConfig property, which is a HostNtpConfig object. The HostNtpConfig objects’s server property contains a list of time servers, specified by IP address or fully qualified domain name.
Important You can start and stop the NTP daemon and retrieve information about it by using the HostServiceSystem object.You can use the HostNetworkSystem.UpdateIPRouteConfig method to specify the IP route configuration for an ESX/ESXi system. The method takes a HostIPRouteConfig data object as an argument. In this object, you can specify the default gateway address and the IPv6 gateway address. The data object also allows you to specify the service console gateway device on ESX.
■ ESX/ESXi 4.0 and later includes an SNMP agent embedded in the ESX/ESXi host daemon (hostd) that can send traps and receive polling requests such as GET requests.The SDK supports SNMP agent configuration through the HostSnmpSystem managed object. This object includes two methods, ReconfigureSnmpAgent and SendTestNotification.
■ HostSnmpSystem.ReconfigureSnmpAgent allows you to specify agent properties through a HostSnmpConfigSpec. That data object allows you to specify the SNMP port, read only communities, and the trap targets in an HostSnmpDestination object. The HostSnmpDestination object allows you to specify the community, and a host and port listening for notification.
■ HostSnmpSystem.SendTestNotification allows you to test your configuration.A HostSnmpSystemAgentLimits data object in the HostSnmpSystem.limits property specifies limits of the agent.