Networking

The networking profile describes the objects used for configuring the system to allow virtual machines to communicate over the network. The global networking objects, used to configure the network switch in the management operating system, include the Msvm_VirtualSwitchManagementService, Msvm_VirtualSwitch, and Msvm_SwitchPort classes. The virtual machine networking objects, used to configure the network interface card (NIC) in the virtual machine, include the Msvm_EmulatedEthernetPort, Msvm_ResourceAllocationSettingData, Msvm_VmLANEndpoint and Msvm_SwitchLANEndpoint classes. The following illustration shows the Virtual Networking Profile.

virtual networking profile

The root of the global networking profile is the Msvm_VirtualSwitch class. This class represents a virtual switch device in the management operating system. Msvm_VirtualSwitch is associated with instances of the Msvm_SwitchPort class, which represents the ports on the virtual switch. Instances of the Msvm_VirtualSwitch and Msvm_SwitchPort classes are created, deleted, and connected via the Msvm_VirtualSwitchManagementService class (not shown in the illustration earlier).

Virtual Switch Management Service (VSMS) represents the networking service present on a single Hyper-V host and contains methods for Msvm_VirtualSwitchManagementService used to control the definition, modification, and destruction of global networking resources such as virtual switches, switch ports and internal Ethernet ports.

The representation of the Ethernet NIC device in the virtual machine looks very similar to that of any other device, as described in the Virtual System Management Service. The Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort classes represent the virtual NIC device, and are configured via an associated Resource Allocation Setting Data (RASD) instance. The only unusual characteristic of this representation is that, when the virtual machine is instantiated and in turn creates the Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort devices, it also creates an associated Msvm_VmLANEndpoint instance for the virtual NIC. Similarly, when the virtual machine is saved or turned off and the Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort instances are destroyed, the associated Msvm_VmLANEndpoint instance is also destroyed. The purpose of the Msvm_VmLANEndpoint is to serve as a bridge for connecting two networking ports to each other. In this case, it is used to connect a virtual NIC to a port on the virtual switch device. In other words, it connects the Msvm_EmulatedEthernetPort and Msvm_SyntheticEthernetPort instances on the virtual machine to a particular Msvm_SwitchPort instance on the virtual switch. To connect a switch to the outside, you must bind the physical Ethernet port to the Msvm_VirtualSwitch through BindExternalEthernetPort. Adversely, when connecting a switch to the host networking stack, or internal NIC, use ConnectInternal to have a virtual machine talk to the host and not the outside world. Msvm_ActiveConnection connects a switch port to the Msvm_SwitchLANEndpoint to which the port is connected inside of Hyper-V. The existence of this object means that the switch port and the Msvm_SwitchLANEndpoint are actively connected and the Ethernet port associated with Msvm_VmLANEndpoint can communicate with the network through the switch port.